ACP2E-4973: Switching from In-Store Delivery to another delivery method does not clear store address from cart

The ACP2E-4973 patch fixes the issue where switching from In-Store Delivery to another delivery method doesn’t clear the store address from the cart. This patch is available when the Quality Patches Tool (QPT) 1.1.86 is installed. The patch ID is ACP2E-4973. Please note that this issue is scheduled to be fixed in Adobe Commerce 2.4.10.

Affected products and versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.8-p5

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.8-p1 - 2.4.8-p5
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the 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

Switching from In-Store Delivery to another delivery method doesn’t clear the store address from the cart.

Prerequisites:

Inventory Management (Multi-Source Inventory) and In-Store Pickup.

Steps to reproduce:

  1. In the Admin, go to Stores > Inventory > Sources and click Add New Source. Enter a Name and Code, enable Use as Pickup Location, enter the Phone under Contact Info, enter the Country, State/Province, City, Street, and Postcode under Address Data, and save the source.

  2. Go to Stores > Inventory > Stocks and click Add New Stock. Enter a Name, select the website under Sales Channels, assign the new source under Sources, and save the stock.

  3. Go to Catalog > Products and create a simple product. In the Sources section, click Assign Sources, select the new source, enter a positive Qty, and save the product.

  4. Go to Stores > Settings > Configuration > Sales > Delivery Methods, expand In-Store Delivery, set Enabled to Yes, and click Save Config.

  5. Using GraphQL as a registered customer, generate a customer token (generateCustomerToken), get the cart ID (customerCart), and add the product to the cart (addProductsToCart).

  6. Set the cart shipping address to the pickup location by sending only the source code in pickup_location_code:

    code language-none
    mutation {
      setShippingAddressesOnCart(input: {
        cart_id: "<cart_id>"
        shipping_addresses: [{ pickup_location_code: "<source_code>" }]
      }) {
        cart { shipping_addresses { pickup_location_code firstname lastname street city postcode } }
      }
    }
    
  7. Switch the cart to Flat Rate and check shipping_addresses in the response:

    code language-none
    mutation {
      setShippingMethodsOnCart(input: {
        cart_id: "<cart_id>"
        shipping_methods: [{ carrier_code: "flatrate", method_code: "flatrate" }]
      }) {
        cart { shipping_addresses { pickup_location_code firstname lastname street city postcode } }
      }
    }
    
  8. Set a billing address (setBillingAddressOnCart) and a payment method (setPaymentMethodOnCart, for example checkmo), then run placeOrder without setting a new shipping address.

Expected results:

  1. After the switch to Flat Rate, pickup_location_code and the pickup store address are removed from the cart shipping address.
  2. You can’t place the order until you set a valid home delivery shipping address with setShippingAddressesOnCart.

Actual results:

  1. After the switch to Flat Rate, the cart shipping address still contains pickup_location_code and the pickup store address.
  2. The order is placed. In Sales > Orders, the shipping address of the order is the pickup store address, although the delivery method is Flat Rate.

Apply the patch

To apply individual patches, use the following links depending on your deployment method:

To learn more about Quality Patches Tool, refer to:

recommendation-more-help
commerce-operations-help-tools