[Solo PaaS]{class="badge informative" title="Applicabile solo ai progetti Adobe Commerce on Cloud (infrastruttura PaaS gestita da Adobe) e ai progetti on-premise."}

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
NOTE
La patch potrebbe diventare applicabile ad altre versioni con le nuove versioni di Quality Patches Tool. Per verificare se la patch è compatibile con la versione di Adobe Commerce in uso, aggiornare il pacchetto 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:

  1. Crea un prodotto semplice con SKU 2836611.

  2. Creare un Cart Price Rule, impostare Coupon su Specific Coupon e immettere TEST1234 come codice coupon.

  3. 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
        }
    }
    }
    
  4. 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
    }
    }
    
  5. Crea un carrello vuoto. Salva l’ID carrello e utilizzalo per le richieste successive.

    code language-none
    mutation {
        createEmptyCart
    }
    
  6. 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
            }
        }
    }
    
  7. 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
                    }
                }
            }
        }
    }
    
  8. 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
                    }
                }
            }
        }
    }
    
  9. 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
                        }
                    }
                }
            }
        }
    }
    
  10. 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
                    }
                }
            }
        }
    }
    
  11. Impostare un metodo di pagamento:

    code language-none
    mutation {
        setPaymentMethodOnCart(
            input: { cart_id: "xxxx", payment_method: { code: "checkmo" } }
        ) {
            cart {
                selected_payment_method {
                    code
                }
            }
        }
    }
    
  12. 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:

Lettura correlata

Per ulteriori informazioni su Quality Patches Tool, vedere:

recommendation-more-help
c2d96e17-5179-455c-ad3a-e1697bb4e8c3