2 min read • Updated 19 days ago
Multilingual & Multi-currency with Webflow Localization
Synchronize Foxy templates with your Webflow site's language and currency settings.
Overview
Localization is essential for delivering a personalized shopping experience for your customers. The following article assumes you have already integrated Foxy into your Website site and have configured Webflow Localization. In this article, we'll accomplish the following:
Configure Foxy template sets
Detect language from your website's URL, subdomain, or subdirectory
Map detected language to a corresponding Foxy template set
Set website visitors Foxy template set (determines language and currency)
Create Template Sets
Foxy template sets are used to determine what currency, language, and other locale settings will be used when that specific template set is chosen.
Add Localization Snippet
<script>
// The key is the language string from the URL, and the value is the corresponding template set code
const templateSets = { en: "English", de: "DEFAULT" };
var FC=FC||{},existingOnLoadUpdateTemplateSet="function"==typeof FC.onLoad?FC.onLoad:function(){};function getTemplateSetFromURL(t){const e=t.split("/"),n=e[2].split(".")[0],a=e[3],o=templateSets[n];if(o)return o;const p=templateSets[a];return p||null}function updateTemplateSet(t){(FC.json.template_set||"DEFAULT")!==t&&FC.client.request(`https://${FC.settings.storedomain}/cart?template_set=${t}`)}function updateTemplateSetAccordingToLanguageOnURI(){const t=getTemplateSetFromURL(window.location.href);t&&updateTemplateSet(t)}FC.onLoad=function(){existingOnLoadUpdateTemplateSet(),FC.client.on("ready.done",updateTemplateSetAccordingToLanguageOnURI)};
</script>
Configure Localization Snippet
For each language/currency, add a key/value pair to this line of the snippet:
const templateSets = { en: "English", de: "DEFAULT" };
The key is the language string in your URL (ie: mydomain.com/de/shop).
The value is the corresponding Foxy template set code (ie: german)
For your default language/currency, set the Foxy template set code value as DEFAULT.
Testing
As always, we recommend testing any changes made. Simply go to any of your website urls (ie: mydomain.com/en/shop, mydomain.com/de/show, etc.). Add products to cart. You should see the chosen language/currency in cart.