MDVA-39521: Unable to set shipping address on carts via GraphQL
The MDVA-39521 patch solves the issue where the user is unable to set shipping address on carts with an empty phone number via GraphQL. This patch is available when the Quality Patches Tool (QPT) 1.1.2 is installed. The patch ID is MDVA-39521. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.4.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.2-p1
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.0 - 2.4.3
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 user is not able to set shipping address on the carts with an empty telephone number via GraphQL despite the fact that the Show Telephone is configured as optional.
Steps to reproduce:
-
Create a simple product.
-
Go to Stores > Configuration > Customers > Customer Configuration > Name and Address Options and set the Show Telephone as Optional.
-
Create an empty cart via GraphQL request.
code language-graphql mutation { createEmptyCart }
-
Add product to cart.
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 } } } }
-
Add address: GRAPHQL VARIABLES.
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 } } } } }
Result:
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" } } ] } } } }
-
Add address with empty phone number.
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 } } } } }
Expected results:
{
"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"
}
}
]
}
}
}
}
Actual results:
{
"data": {
"setShippingAddressesOnCart": {
"cart": {
"shipping_addresses": []
}
}
}
}
Apply the patch
To apply individual patches, use the following links depending on your deployment type:
- 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:
For info about other patches available in QPT, refer to the Patches available in QPT section.