Manage Multiple Currencies in CMS

This guide offers comprehensive instructions for seamlessly integrating multiple currencies into the Doofinder search functionality within your custom CMS platform. If you're utilizing one of our plugins, you can skip this step, as the script injection is handled within the plugin.

Managing Multiple Currencies

In cases where your store supports multiple currencies for the same language, it's essential to configure the Doofinder script appropriately. This involves adding the currency attribute to the script to ensure seamless integration with Doofinder's search functionality based on the user's selected currency.

Configuration Steps

1. Create Separate Search Engines: For each language/currency combination, create a separate search engine within your Store settings. For instance, if your English store supports Euros (€), US Dollars ($), and British Pounds (£), you would create three distinct search engines:

  • EN - EUR
  • EN - USD
  • EN - GBP

Take a look at this documentation for easy-to-follow instructions.

2. Script Configuration: Adjust the Doofinder script to include the currency attribute. This informs Doofinder which search engine to use based on the user's selected currency.

Ensure that the currency attribute is set to the currency visible to the end-user. For example, if the user is viewing the page with Euros, the script should be configured as follows:

<script>
  const dfLayerOptions = {
    installationId: 'XXXX-XXXX-XXXX-XXXX',
    zone: 'XX',
    currency: 'EUR' // Set to the appropriate currency code ('EUR', 'USD', 'GBP', etc.)
  };

  (function (l, a, y, e, r, s) {
    r = l.createElement(a); r.onload = e; r.async = 1; r.src = y;
    s = l.getElementsByTagName(a)[0]; s.parentNode.insertBefore(r, s);
  })(document, 'script', 'https://cdn.doofinder.com/livelayer/1/js/loader.min.js', function () {
    doofinderLoader.load(dfLayerOptions);
  });
</script>

You should dinamically change the currency value, depending on the one selected by the end-user. For example, in your HTML code, you should index the following variable:

let selectedCurrency = 'EUR';

In the Doofinder script, use:

<script>
  const dfLayerOptions = {
    installationId: 'XXXX-XXXX-XXXX-XXXX',
    zone: 'XX',
    currency: selectedCurrency
  };

  (function (l, a, y, e, r, s) {
    r = l.createElement(a); r.onload = e; r.async = 1; r.src = y;
    s = l.getElementsByTagName(a)[0]; s.parentNode.insertBefore(r, s);
  })(document, 'script', 'https://cdn.doofinder.com/livelayer/1/js/loader.min.js', function () {
    doofinderLoader.load(dfLayerOptions);
  });
</script>

By following these steps and adjusting the Doofinder script accordingly, you ensure that your store integrates with Doofinder's search functionality, catering to users across different currencies within the same language setting.