0

how to remove ?___from_store=de on the url?

http://exsample.com/en/?___from_store=de

Please post genuine ans!

Updated after @Andreas von Studnitz Suggestion. (See File Structure)

In Custom Module di.xml

<type name="Magento\Store\Model\Store">
        <plugin name="cremove_query_string" type="Custom\Module\Plugin\Store\Model\Store" sortOrder="1" />
    </type>

In Custom\Module\Plugin\Store\Model\Store.php

namespace Custom\Module\Plugin\Store\Model;

public function beforeGetCurrentUrl(\Magento\Store\Model\Store $store, $fromStore=true)
{
    return [false];
}
  • In magento backend you can find the option to add store code to url. In that case your will not get the query string. – Priyank Apr 30 '18 at 6:05
  • Yes, I know this(already set to yes) but in my case query string coming after store code(en). @ Priyank – Gagandeep Singh Apr 30 '18 at 12:22
  • @GagandeepSingh you done this? can you please share your code/module – Ravi Varma Aug 3 at 7:54
1

This comes from \Magento\Store\Model\Store::getCurrentUrl:

public function getCurrentUrl($fromStore = true)
{...

If you change the default value of the variable $fromStore from true to false, the parameter won't show up any more. You can archieve that with a before plugin as follows:

public function beforeGetCurrentUrl(Store $store, $fromStore = true)
{
    return [false];
}
  • Thanks sir, Please see my updated ans for all in detail who facing problem like this! – Gagandeep Singh May 1 '18 at 5:24
  • @GagandeepSingh So does my suggestion work for you or doesn't it? I tested it on my machine... – Andreas von Studnitz May 2 '18 at 6:04
  • Yes, Its worked. – Gagandeep Singh May 2 '18 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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