Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <event name="controller_action_predispatch">
- <observer name="switch_store" instance="NamespaceModulenameObserverSwitchStore" shared="false" />
- </event>
- protected $storeManager;
- public function __construct(
- MagentoStoreModelStoreManagerInterface $storeManager
- ) {
- $this->storeManager = $storeManager;
- }
- public function execute(MagentoFrameworkEventObserver $observer) {
- if ($this->firstVisit()) { // Customer's first visit logic inside firstVisit() function
- $storeId = $this->storeManager->getStore($target_store)->getId();
- $this->storeManager->setCurrentStore($storeId);
- }
- return $this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement