cancel
Showing results for 
Search instead for 
Did you mean: 

2.3.2 - Wrong store view being loaded with some products

SOLVED

2.3.2 - Wrong store view being loaded with some products

Hello!

 

I have a Magento 2.3 store with several store views for different languages, accessed via domain.com/it, domain.com/fr, domain.com/be etc etc. 

Have a look below:

stores.jpg

The majority of products are accessible on all views but some are restricted to base (en) only.

I'm having an issue where if a product is only assigned to the base store,  the site will load it in an incorrect store view.

So, for example, I have a product assigned to the English store (which is just accessed from the domain, without a subdirectory). When I open this product on the front end, it will load it in the Italian store view. 

 

Interestingly, if I go to the same url with the IT store code (e.g. if the problem url is domain.com/product, I go to domain.com/it/product) it 404's!

The funny thing is, I don't know why it's choosing a particular store view to load as default. There's no reason why Italian is treated as the store to display (as it alongside French and Netherlands has a sort order of 0).


Other things I have noticed:

  • If I change the theme to base, the issue still occurs
  • If I assign a product to more than 1 store view (for example base and italian) it loads the correct store view
  • getCurrentStoreCode(); in the language switcher returns the incorrect store code, but $store->getWebsite()->getCode()(from a custom extension) loads the correct code.

If anyone can shed some light on this, I would be most grateful. I have a feeling it could be how the stores are set up, but I'm fairly certain I've done it correctly.

I've also posted this on stackexchange, but I've had no replies. I'm absolutely stuck - I have no idea why this is happening :-(

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: 2.3.2 - Wrong store view being loaded with some products

Ok, I have solved it.

I'm using this extension - https://www.magmodules.eu/magento2-alternate-hreflang.html. I disabled it and lo and behold the correct languages load! 

Looking at the vendor website, it appears I'm 2 versions out of date, so I will upgrade and see if that fixes it!

View solution in original post

3 REPLIES 3

Re: 2.3.2 - Wrong store view being loaded with some products

Hello @tmaharding 

 

If you are using a custom theme like Theme monster, then please disable layout switcher from admin panel.

 

It will solve your issue.

 

Hope it helps.

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

Re: 2.3.2 - Wrong store view being loaded with some products

Hey @Meetanshi. Thank you for the reply.

Unfortunately, I don't have that section in my CMS - I use Infortis Ultimo theme. 

What would the layout switcher do from a technical point of view (so maybe I can see if Infortis has a similar feature)?

Thanks :-)

Tom 

Re: 2.3.2 - Wrong store view being loaded with some products

Ok, I have solved it.

I'm using this extension - https://www.magmodules.eu/magento2-alternate-hreflang.html. I disabled it and lo and behold the correct languages load! 

Looking at the vendor website, it appears I'm 2 versions out of date, so I will upgrade and see if that fixes it!