ACSD-64431: The “placeOrder” mutation with coupon code in the request throws an internal server error
The ACSD-64431 patch fixes the issue where the placeOrder mutation containing the coupon code information in the request throws an internal server error instead of placing the order successfully. This patch is available when the Quality Patches Tool (QPT) 1.1.61 is installed. The patch ID is ACSD-64431. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.8.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.7-p3
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.7 - 2.4.7-p4
magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
The placeOrder mutation that contains the coupon code information in the request throws an internal error, instead of placing the order successfully.
Steps to reproduce:
-
Create a simple product with SKU 2836611.
-
Create a Cart Price Rule, set Coupon to
Specific Couponand enter TEST1234 as the coupon code. -
Create a customer:
code language-none mutation { createCustomer( input: { firstname: "John" lastname: "Doe" email: "john.doe@example.com" password: "b1b2b3l@w+" is_subscribed: true } ) { customer { firstname lastname email is_subscribed } } } -
Generate a customer token. You can use this token for subsequent requests.
code language-none mutation { generateCustomerToken(email: "john.doe@example.com", password: "b1b2b3l@w+") { token } } -
Create an empty cart. Save the cart ID and use it for the subsequent requests.
code language-none mutation { createEmptyCart } -
Add the product to the cart:
code language-none mutation { addProductsToCart( cartId: "xxxx" cartItems: [{ quantity: 1, sku: "2836611" }] ) { cart { itemsV2 { items { product { name sku } ... on ConfigurableCartItem { configurable_options { configurable_product_option_uid value_label } } quantity } total_count page_info { page_size current_page total_pages } } } user_errors { code message } } } -
Apply the coupon:
code language-none mutation { applyCouponToCart(input: { cart_id: "xxxx", coupon_code: "TEST1234" }) { cart { itemsV2 { items { product { name } quantity } total_count page_info { page_size current_page total_pages } } applied_coupons { code } prices { grand_total { value currency } } } } } -
Set a shipping address:
code language-none mutation { setShippingAddressesOnCart( input: { cart_id: "xxxxx" shipping_addresses: [ { address: { firstname: "John" lastname: "Doe" company: "Company Name" street: ["3320 N Crescent Dr", "Beverly Hills"] city: "Los Angeles" region: "CA" region_id: 12 postcode: "90210" country_code: "US" telephone: "123-456-0000" save_in_address_book: false } } ] } ) { cart { shipping_addresses { firstname lastname company street city region { code label } postcode telephone country { code label } available_shipping_methods { carrier_code carrier_title method_code method_title } } } } } -
Set a shipping method:
code language-none mutation { setShippingMethodsOnCart( input: { cart_id: "xxxx" shipping_methods: [{ carrier_code: "flatrate", method_code: "flatrate" }] } ) { cart { shipping_addresses { selected_shipping_method { carrier_code carrier_title method_code method_title amount { value currency } } } } } } -
Set a billing address:
code language-none mutation { setBillingAddressOnCart( input: { cart_id: "xxxx" billing_address: { address: { firstname: "John" lastname: "Doe" company: "Company Name" street: ["64 Strawberry Dr", "Beverly Hills"] city: "Los Angeles" region: "CA" region_id: 12 postcode: "90210" country_code: "US" telephone: "123-456-0000" save_in_address_book: true } } } ) { cart { billing_address { firstname lastname company street city region { code label } postcode telephone country { code label } } } } } -
Set a payment method:
code language-none mutation { setPaymentMethodOnCart( input: { cart_id: "xxxx", payment_method: { code: "checkmo" } } ) { cart { selected_payment_method { code } } } } -
Place the order:
code language-none mutation { placeOrder( input: { cart_id: "{{cart_id}}" } ) { orderV2 { number token } errors { message code } } }
Expected results:
The order should be placed.
Actual results:
The following error message appears:"message": "Internal server error"
exception.log contains the following error:
report.ERROR: "discount_model" value should be specifiedGraphQL (1:135)
1: mutation { placeOrder(input: {cart_id: "xxxx"}) { orderV2 { total { discounts { amount { currency value } coupon { code } } } } errors { message code } } }
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide.
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide.
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide.