Question

I have created 3 store for example:

  1. Australia
  2. India
  3. USA

and created related store view as show below: enter image description here

In my case if any customer is register from any store or store view. They are successfully register from any store/storeview. and successfully login from any store/storeview but after login from any store/storeview when user click on store/storeview switcher it's will not working. In admin setting I have done

  1. Add Store Code to Urls to Yes
  2. Customer Share to "Globe"

Now problem is that I am able to login from any store/storeview but not able to switch from one store to another store after login, without login it's successfully working.

enter image description here

Anyone is able to help me for solve this issue.

enter image description here

Was it helpful?

Solution

After lot's of debug found that This issue in Magento 2.3.3 Default version.

In order to prevent this bug on 2.3.3, you need to update "vendor\magento\module-store\etc or override :

magento2/app/code/Magento/Store/etc/di.xml and comment to hashGenerator then the store switcher works for logged in customers.

Before

<type name="Magento\Store\Model\StoreSwitcher">
        <arguments>
            <argument name="storeSwitchers" xsi:type="array">
                <item name="cleanTargetUrl" xsi:type="object">Magento\Store\Model\StoreSwitcher\CleanTargetUrl</item>
                <item name="manageStoreCookie" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManageStoreCookie</item>
                <item name="managePrivateContent" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManagePrivateContent</item>
              <item name="hashGenerator" xsi:type="object">Magento\Store\Model\StoreSwitcher\HashGenerator</item>
            </argument>
        </arguments>
    </type>

After:

<type name="Magento\Store\Model\StoreSwitcher">
            <arguments>
                <argument name="storeSwitchers" xsi:type="array">
                    <item name="cleanTargetUrl" xsi:type="object">Magento\Store\Model\StoreSwitcher\CleanTargetUrl</item>
                    <item name="manageStoreCookie" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManageStoreCookie</item>
                    <item name="managePrivateContent" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManagePrivateContent</item>
                    <!-- <item name="hashGenerator" xsi:type="object">Magento\Store\Model\StoreSwitcher\HashGenerator</item> -->
                </argument>
            </arguments>
        </type>

OTHER TIPS

You can find more info about this issue here: https://github.com/magento/magento2/issues/24942

To fix issue, you don't need to remove HashGenerator row in vendor/magento/module-store/etc/di.xml, just set sortOrder="1000 for it, so it will look like:

        <argument name="storeSwitchers" xsi:type="array">
            <item name="cleanTargetUrl" xsi:type="object">Magento\Store\Model\StoreSwitcher\CleanTargetUrl</item>
            <item name="manageStoreCookie" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManageStoreCookie</item>
            <item name="managePrivateContent" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManagePrivateContent</item>
            <item name="hashGenerator" sortOrder="1000" xsi:type="object">Magento\Store\Model\StoreSwitcher\HashGenerator</item>
        </argument>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top