4

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

7
  • Can you please check your URL after changing store and before it ? Commented Oct 18, 2019 at 6:14
  • I can see that before clicking on AU or IN, you have URL with base_url/magento2/ and in next image magento2 is missing I believe. Commented Oct 18, 2019 at 6:15
  • Yes, My URL is base_url/magento2/ but after login when customer switch to store it's going to wrong url even without login it's working proper. Commented Oct 18, 2019 at 6:21
  • Hmmm, that's ODD Commented Oct 18, 2019 at 6:24
  • Let me check if I can able to find some solution for you then, will let you know after some research.. Commented Oct 18, 2019 at 6:24

2 Answers 2

5

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>
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.