Skip to main content
All CollectionsIntegration and implementationUGC widgets for your website
Set language and currencies programmatically (advanced)
Set language and currencies programmatically (advanced)

How to force a specific market using the data-markets attribute instead of auto-matching with the URL.

Erik Droh avatar
Written by Erik Droh
Updated over a year ago

If you found this article, you're probably a developer who wants full control of what you're doing and have the Cevoid galleries working on your development environment as well!

All galleries and cards, by default, automatically match a market that is set up in Cevoid based on URLs.

However, all Cevoid galleries and cards accept an attribute called data-markets that enables developers to force which market should be loaded in the galleries to change the currency and language.

Examples

The example below will auto-match using the URL of the loaded page to find which market should be used

<div id="cevoid-container" data-gallery="{GALLERY_ID}"></div>

The example below will force the German market wherever the gallery is loaded.

<div id="cevoid-container" data-gallery="{GALLERY_ID}" data-market="m-ziGFSUrjltKvZYHVpXFW7"></div>

Finding the MARKET_ID

You can find the MARKET_ID for each market where you manage product and markets in Cevoid. Click the 3 dots icon (...) on any market and copy the MARKET_ID.

Mapping to the correct market

Now all you need to do is map the different language and currency settings on your website to a desired MARKET_ID and you are good to go!

Custom ids

If you already have unique ids for your markets that you would like to use instead of the Cevoid MARKET_IDs you can add your own custom value per market under the Advanced settings when editing the market!


Override a market's currency & price (Advanced use-case)

For stores that want to be able to set languages and prices freely, we have an attribute called data-market-currency which allows you to override a data-market if used in combination.

Example

<div id="cevoid-container" data-gallery="{GALLERY_ID}" data-market="m-eng25iu7" data-market-currency="m-swei2u89"></div>

In the code above the gallery fetches a specific gallery and loads the english market (m-eng25iu7) but fetches the currency and prices for the swedish market (m-swei2u89) instead!

This comes in handy if a user visits your international store URL but is browsing from another country and should therefore see the prices in the country's origin currency.


Hide prices (Advanced use-case)

We also have an attribute called data-hide-prices={boolean}. This attribute allows you to hide the prices if you want to programmatically.

Did this answer your question?