Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Multiple Shopify Stores for Multiple Currencies - How to Grab the Store URL from a Query

12 replies
Last updated: Oct 3, 2022
Hi there, I’m trying to use multiple Shopify stores to display multiple currencies. Is there is way to grab the store URL from the query? I’m using the Shopify <> Sanity official app but unfortunately I can’t find any data related to the currency or store ID. Also did you guys managed to fetch the metafields values?
Sep 28, 2022, 4:13 AM
I don't have much experience with Shopify Connect, but this example document include a gid, which may be what you're looking for. If not, you can probably create a custom sync handler that adds that information in!
Sep 28, 2022, 3:31 PM
user M
thanks for your help! Unfortunately the gid doesn’t allow me to group the products by store or currency. I saw the custom sync handler doc so I’m going to try this way but I’d prefer to avoid this additional step.
I don’t know if there is a lot of demand on this feature but IMO being able to fetch products from multiple stores is a must have for big international Shopify websites. Usually the best way to handle multiple currencies and stock per region on Shopify is by having one store per currency/region. Shopify Market is out since a few months but the conversion fees are way too high.
Here is the architecture I’m trying to build:
• User browse the website from France > products & collections from Shopify store A are used
• User browse the website from USA > products & collections from Shopify store B are used
Your connection with Shopify is very good and I’m impressed how real time it is. The only thing missing is the store ID
Sep 28, 2022, 4:06 PM
Let me ask the folks who built the connector if there's some way to get this!
Sep 29, 2022, 6:05 PM
user M
Sep 29, 2022, 6:08 PM
I was also wondering why the product.collection array isn’t available in the product object. Right now there is no way to list products that are linked to a specific collection.
Sep 29, 2022, 6:11 PM
Ok, confirmed that you'll need to write a custom sync handler for this. I don't have experience writing them, so I can't guide you much more than that!
Sep 30, 2022, 4:00 PM
Ok thanks
user M
Sep 30, 2022, 4:03 PM
user M
I took some time to play with a custom sync handler. Here is the payload I receive on each request:
Oct 3, 2022, 8:22 PM
The Connect App doesn’t give me access to the product.collections array.
Oct 3, 2022, 8:23 PM
The payload is exactly the same as the data I have in the data lake, so there is no way for me to know from which Shopify store the data is from
Oct 3, 2022, 8:24 PM
Also here is a collection payload
Oct 3, 2022, 8:26 PM
There is no link between a collection id and a product id which is too bad
Oct 3, 2022, 8:26 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?