Handling multiple currencies using Shopify's jquery.currencies.min.js

Hi!

I’m looking at using Algolia in our shopify store (nordickind.com). I really like it, very easy to set up!

The remaining issue is that we have support for multiple currencies in the shop but it does not look like this is supported out of the box in the autocomplete and instant_search implementations. What is the best way to handle this?

A quick fix could be to remove all prices in search results, but it would be nice display them to the customer.

Thanks!

Thanks a lot for this feedback!

I do agree that removing prices wouldn’t be ideal.
Which solution are you using to support those multiple currencies?

The currency handling is part of the theme we are using (https://themes.shopify.com/themes/grid/styles/light). I have not had the time to dig too deep into it but I think it is implemented along the lines of this article https://help.shopify.com/themes/customization/currencies/show-multiple-currencies.

My guess is that it should be fairly easy to fix the prices on the products, not sure about the price facets though, I have not looked at the implementation.

If it is indeed following this tutorial, the whole idea would be to:

  • change our product templates autocomplete_product.hogan.liquid and instant_search_product.hogan.liquid to use <span class="money">...</span> around the prices.
  • get the store currency with var shopCurrency = '{{ shop.currency }}';
  • get the user currency with var userCurrency = Currencies.currentCurrency;
  • then to call convertAll on each render using something like
    instant.search.on('render', function () {
      Currencies.convertAll(
        shopCurrency,
        userCurrency,
        'your_instant_search_selector span.money'
      )
    });
    

For the autocomplete, the same logic would apply.
Events are described here: https://github.com/algolia/autocomplete.js/blob/master/README.md .
In your case, I think autocomplete:updated would be the relevant one.