MDVA-39521:无法通过GraphQL设置购物车上的配送地址

MDVA-39521修补程序解决了用户无法通过GraphQL为电话号码为空的购物车设置送货地址的问题。 此修补程序在以下情况下可用: Quality Patches Tool (QPT) 已安装1.1.2。 修补程序ID为MDVA-39521。 请注意,该问题计划在Adobe Commerce 2.4.4中修复。

受影响的产品和版本

该修补程序是为Adobe Commerce版本创建的:

  • Adobe Commerce(所有部署方法) 2.4.2-p1

与Adobe Commerce版本兼容:

  • Adobe Commerce(所有部署方法) 2.4.0 - 2.4.3
NOTE
该修补程序可能适用于具有新的Quality Patches Tool版本的其他版本。 要检查该修补程序是否与您的Adobe Commerce版本兼容,请更新 magento/quality-patches 包到最新版本,并检查 Quality Patches Tool:搜索修补程序页面. 使用修补程序ID作为搜索关键字来查找修补程序。

问题

用户无法通过GraphQL为电话号码为空的购物车设置送货地址,尽管Show Telephone配置为可选。

重现问题的步骤

  1. 创建一个简单的产品。

  2. 转到 商店 > 配置 > 客户 > 客户配置 > 名称和地址选项 并将“Show Telephone(显示电话)”设置为“Optional(可选)”。

  3. 通过GraphQL请求创建一个空购物车。

    code language-graphql
    mutation {
    createEmptyCart
    }
    
  4. 将产品添加到购物车。

    code language-graphql
    mutation {
    addSimpleProductsToCart(
    input: {
      cart_id: "{ CART_ID }"
      cart_items: [
        {
          data: {
            quantity: 1
            sku: "24-MG04"
          }
        }
      ]
    }
    ) {
    cart {
      items {
        id
        product {
          sku
          stock_status
        }
        quantity
      }
    }
    }
    }
    
  5. 添加地址:GRAPHQL变量。

    code language-graphql
    {
      "cartId": "6Efw00UbjPoP5cvTFhsswDTjpxs0Xupt"
    }
    
    code language-graphql
    mutation ($cartId: String!) {
      setShippingAddressesOnCart(input: {cart_id: $cartId, shipping_addresses:
      {address: {firstname: "John", lastname: "Doe", company: "Company Name",
      street: ["820 Burrard Street"], city: "Vancouver", region: "BC", postcode: "V6Z 2J1",
      country_code: "CA", telephone: "123-456-0000", save_in_address_book: false}}}) {
        cart {
          shipping_addresses {
            firstname
            lastname
            company
            street
            city
            postcode
            telephone
            country {
              code
              label
            }
          }
        }
      }
    }
    

    结果:

    code language-graphql
      {
          "data": {
              "setShippingAddressesOnCart": {
                  "cart": {
                      "shipping_addresses": [
                          {
                              "firstname": "John",
                              "lastname": "Canada",
                              "company": "Company Name",
                              "street": [
                                  "820 Burrard Street"
                              ],
                              "city": "Vancouver",
                              "postcode": "V6Z 2J1",
                              "telephone": "123-456-0000",
                              "country": {
                                  "code": "CA",
                                  "label": "CA"
                              }
                          }
                      ]
                  }
              }
          }
      }
    
  6. 添加电话号码为空的地址。

    code language-graphql
    mutation ($cartId: String!) {
      setShippingAddressesOnCart(input: {cart_id: $cartId, shipping_addresses: {address: {firstname:
        "John", lastname: "Canada", company: "Company Name", street: ["820 Burrard Street"], city:
        "Vancouver", region: "BC", postcode: "V6Z 2J1", country_code: "CA", telephone: "123-456-0000",
        save_in_address_book: false}}}) {
        cart {
          shipping_addresses {
            firstname
            lastname
            company
            street
            city
            postcode
            telephone
            country {
              code
              label
            }
          }
        }
      }
    }
    

预期结果

 {
    "data": {
        "setShippingAddressesOnCart": {
            "cart": {
                "shipping_addresses": [
                    {
                        "firstname": "John",
                        "lastname": "Doe",
                        "company": "Company Name",
                        "street": [
                            "820 Burrard Street"
                        ],
                        "city": "Vancouver",
                        "postcode": "V6Z 2J1",
                        "telephone": "",
                        "country": {
                            "code": "CA",
                            "label": "CA"
                        }
                    }
                ]
            }
        }
    }
 }

实际结果

{
    "data": {
        "setShippingAddressesOnCart": {
            "cart": {
                "shipping_addresses": []
            }
        }
    }
}

应用修补程序

要应用单个修补程序,请根据您的部署类型使用以下链接:

相关阅读

要了解有关Quality Patches Tool的更多信息,请参阅:

有关QPT中可用的其他修补程序的信息,请参阅 QPT中可用的修补程序 部分。

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a