We have a multi-store setup with more than 10 stores (different languages and domains), which share many products between them.
The problem:
If we want to do a product promotion on say - Instagram, and include a product URL in the description, it would only be one store (obviously, its dumb to direct a Spanish customer to a Danish site), so:
How to create a "universal" URL which will automatically redirect the customer to the correct store (based on location and language).
Note: Our sites do have hreflang
with alternate hrefs
set up.
EDIT
Our store is based on Magento framework. My current idea:
1)Have a URL with a parameter of a product ID.
2)This URL directs to a PHP file in which I receive the parameter, by which I can get the product data, then I can loop through the available alternate hrefs (from database).
3)I get the user locale and language (Im not very sure how to do this).
4)Check if any of the available hreflang matches this user and direct them to it.