I’m creating a Shopify app that uses app proxy to render a list of products on the merchant webstore.
If the store supports multiple countries/markets, then the customer can select his country using “Country/region selector” from the footer:
I want to show the products (with prices in local currency) specific to the user selected country.
Question
Is it possible somehow for the app proxy server to access the country that user has selected?
I’d like to use the country information to perform contextual Storefront Graphql queries to support multiple markets.
query @inContext(country: GB) { # <---- use the country for contextual query
products(first: 2) {
nodes {
title
variants(first: 1) {
nodes {
price {
amount
currencyCode
}
}
}
}
}
}
Additional info
The webstore liquid allows accessing the country using {{ localization.country.iso_code }}
and Shopify server injects dynamically into the store webpage the country as well:
I can, of course, do the fetching from the client side adding the country as a parameter. However, I’d like to access the country directly on the app proxy server side.
Thank you!