Predictive Search API Cache and Rounding Issue

thiago_h
New Member
1 0 0

I'm working on a project that uses Predictive Search API and Script Tag API.

I was testing it in a store that works with Shopify's default multi-currency mode and it has the dollar as its default currency.

What is happening is that when I change the currency of the page and use the same query I did before (using the Predictive Search API), I still get results in dollars and if I make a different query, I get a result with the currency I selected, but with a rounded value and different from that shown on the store page.


Below is the step-by-step description inside a context:

- The store has the dollar as its default currency and uses Shopify's default multi-currency mode
- There are two products in the store, a USB cable ($3) and a smartwatch ($36)
- I made a request to the Predictive Search API with the query "u" them "s", they each result is correct
- I change the store currency at the bottom of the store page to Korean Won (just as a customer does)
- The page shows the prices of 3328 KRW for the USB cable and 39939 KRW for the smartwatch
- I made a request with the query "us", and it returns the rounded value 4000 KRW to the USB cable
- I made a request with the query "sw", and it returns the rounded value 40000 KRW to the smartwatch
- I made a request with the query "u" or "s", and it keeps returning the result in dollars
- If I switch to the Japanese yen, the same happens, the same problem with caching and rounding
- If I repeat the queries I made before, it returns the amounts in the currencies in which I originally made the requests


The request I'm using is https://"mystore".myshopify.com/search/suggest.json?q=u&resources[type]=product,page,article,collection&options[unavailable_products]=hide

0 Likes