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

See below:

enter image description here

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

I'm having an issue where if a product is only assigned to the base store view, the site will load it in an incorrect store view. In most cases it loads it in Italian. 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.

1 Answer 1


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!

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.