This guide offers comprehensive instructions for seamlessly integrating multiple currencies into the Doofinder search functionality within your custom CMS platform. You can skip this step if you're using one of our plugins, 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
- 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:
- 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.
– EN - EUR
– EN - USD
– EN - GBP
Take a look at this documentation for easy-to-follow instructions.
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>
(function(w, k) {w[k] = window[k] || function () { (window[k].q = window[k].q || []).push(arguments) }})(window, "doofinderApp")
doofinderApp("config", "language", "en")
doofinderApp("config", "currency", "EUR") // Set to the appropriate currency code ('EUR', 'USD', 'GBP', etc.)
</script>
<script src="https://eu1-config.doofinder.com/2.x/50ff970f-8f03-41f9-8203-0f9767f6ab99.js" async></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>
(function(w, k) {w[k] = window[k] || function () { (window[k].q = window[k].q || []).push(arguments) }})(window, "doofinderApp")
doofinderApp("config", "language", "en")
doofinderApp("config", "currency", selectedCurrency) // Set to the appropriate currency code ('EUR', 'USD', 'GBP', etc.)
</script>
<script src="https://eu1-config.doofinder.com/2.x/50ff970f-8f03-41f9-8203-0f9767f6ab99.js" async></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.