-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Directives (inContext) #692
Comments
Hey @PaulBouisset, did you configure custom prices for this specific country?
|
I do not have a country specific price for US but currently this query is working when I use the shopify Graphql app and my shop is returning prices in dollar if I set the @incontext directive to US and in euro if I set it to "FR". I am just not sure how to build the query with the shopify client from nuxt-shopify. Do I send a "raw" query like the one I described above? If yes, how do I send it? Because currently if I understood correctly Or do I use the technic like this and I can specify the @incontext directive somewhere:
|
Here's an example: https://github.com/Shopify/js-buy-sdk#fetching-products-1 You need to use the
You can try, this part of the SDK is not really documented so you might have to dig in a bit, also I'm not sure you can add a directive with their SDK, I could be wrong. I reckon you could just query the storefront API directly: const query = `
query allProducts @inContext(country: US) {
products(first: 1) {
pageInfo { hasNextPage, hasPreviousPage }
edges {
node {
variants(first: 1) {
pageInfo { hasNextPage, hasPreviousPage }
edges {
node {
priceV2 {
amount
currencyCode
}
}
}
}
}
}
}
}
`;
const body = JSON.stringify({ query });
fetch("YOUR_SHOPIFY_STOREFRONT_GRAPHQL_ENDPOINT", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Storefront-Access-Token": "YOUR_TOKEN"
},
body,
})
.then((res) => res.json())
.then(({ data }) => console.log(data)); |
Hi, I am not sure if it's already the case but it seems that directive like
@inContext
are not supported currently by the shopify client.I tried to use the
@incontext
directive in my query like explained in this guide but with no success.Is there a way to check if it's working or maybe I am doing something wrong but just want to check.
My query:
The text was updated successfully, but these errors were encountered: