The MDVA-34469 Magento patch solves the issue where users get the error message: Wrong store code specified for cart when adding a product to the cart after switching store views.
This patch is available when the Magento Quality Patch (MQP) tool 1.0.15 is installed. Please note that the issue is scheduled to be fixed in Magento 2.4.2.
Affected products and versions
The patch is created for Magento version:
Magento Commerce Cloud 2.4.1.
Compatible with Magento versions:
Magento Commerce Cloud and Magento Commerce 2.4.1, 2.4.1-p1.
Note: the patch can be applicable to other versions. To check if the patch is compatible with your Magento version, run ./vendor/bin/magento-patches status
.
Issue
The user sees a cart query error, "Wrong store code specified for cart", when trying to switch store views.
Steps to reproduce:
Prerequisites:
- Magento 2.4.0.
- Single website with a single store and two store views is configured.
- A customer account is created.
- Magento backend is configured to have 2 store views (with store codes: default, second).
- The user creates a shopping cart using the default store code.
- The user tries to retrieve this cart using the second store code in the Store request header.
Actual result:
The cart query returns an error and the cart does not display.
Expected result:
The cart displays because switching the store (sending the new code in the Store
request header) associates the cart to the requested store.
Apply the patch
For instructions on how to apply an MQP patch, use the following links depending on your Magento product:
- Magento Commerce: DevDocs Apply patches using Magento Quality Patches Tool.
- Magento Commerce Cloud: DevDocs Upgrades and Patches > Apply patches.
Related reading
To learn more about Magento Quality Patches, refer to:
- Magento Quality Patches released: a new tool to self-serve quality patches.
- Check if patch is available for your Magento issue using Magento Quality Patches.
For info about other patches available in MQP tool, refer to the Patches available in MQP tool section.