ACSD-64431: la mutazione "placeOrder" con codice coupon nella richiesta genera un errore interno del server
La patch ACSD-64431 risolve il problema per cui la mutazione placeOrder contenente le informazioni sul codice coupon nella richiesta genera un errore interno del server invece di eseguire l'ordine correttamente. Questa patch è disponibile quando è installato Quality Patches Tool (QPT) 1.1.61. L’ID della patch è ACSD-64431. Il problema è pianificato per essere risolto in Adobe Commerce 2.4.8.
Prodotti e versioni interessati
La patch è stata creata per la versione di Adobe Commerce:
- Adobe Commerce (tutti i metodi di implementazione) 2.4.7-p3
Compatibile con le versioni di Adobe Commerce:
- Adobe Commerce (tutti i metodi di implementazione) 2.4.7 - 2.4.7-p4
magento/quality-patches alla versione più recente e verificare la compatibilità nella pagina Quality Patches Tool: Cerca patch. Utilizza l’ID patch come parola chiave di ricerca per individuare la patch.Problema
La mutazione placeOrder che contiene le informazioni sul codice coupon nella richiesta genera un errore interno, invece di eseguire l'ordine correttamente.
Passaggi da riprodurre:
-
Crea un prodotto semplice con SKU 2836611.
-
Creare un Cart Price Rule, impostare Coupon su
Specific Coupone immettere TEST1234 come codice coupon. -
Creare un cliente:
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 } } } -
Genera un token cliente. Puoi utilizzare questo token per le richieste successive.
code language-none mutation { generateCustomerToken(email: "john.doe@example.com", password: "b1b2b3l@w+") { token } } -
Crea un carrello vuoto. Salva l’ID carrello e utilizzalo per le richieste successive.
code language-none mutation { createEmptyCart } -
Aggiungi il prodotto al carrello:
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 } } } -
Applica il 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 } } } } } -
Impostare un indirizzo di spedizione:
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 } } } } } -
Impostare un metodo di spedizione:
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 } } } } } } -
Imposta un indirizzo di fatturazione:
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 } } } } } -
Impostare un metodo di pagamento:
code language-none mutation { setPaymentMethodOnCart( input: { cart_id: "xxxx", payment_method: { code: "checkmo" } } ) { cart { selected_payment_method { code } } } } -
Effettua l’ordine:
code language-none mutation { placeOrder( input: { cart_id: "{{cart_id}}" } ) { orderV2 { number token } errors { message code } } }
Risultati previsti:
L’ordine deve essere effettuato.
Risultati effettivi:
Viene visualizzato il seguente messaggio di errore:"message": "Internal server error"
exception.log contiene il seguente errore:
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 } } }
Applicare la patch
Per applicare singole patch, utilizzare i collegamenti seguenti, a seconda del metodo di distribuzione utilizzato:
- Adobe Commerce o Magento Open Source on-premise: Quality Patches Tool > Utilizzo nella guida di Quality Patches Tool.
- Adobe Commerce su infrastruttura cloud: Aggiornamenti e patch > Applica patch nella guida Commerce su infrastruttura cloud.
Lettura correlata
Per ulteriori informazioni su Quality Patches Tool, vedere:
- Quality Patches Tool: strumento self-service per patch di qualità nella guida degli strumenti.