Focusing on managing products, variants, and collections through the API.
Hello everyone,
I have a Markets and, I have changed the currency in Markets (eg. TRY)
When I use Graphql to get product information with price, I use contextualPricing to get price in Markets.
query product { product(id: "gid://shopify/Product/9253881610551") { id title variants(first: 5) { edges { node { id title contextualPricing(context: {country: TR}) { price { amount currencyCode } compareAtPrice { amount currencyCode } } } } } } }
Result:
{ "data": { "product": { "id": "gid://shopify/Product/9253881610551", "title": "0-18 Months Newborn Infant Clothes Set Toddler Baby Girls Floral Tops Brown Short Pants Baby Girls Outfits Newborn Clothing 9394894", "variants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/48196263248183", "title": "18M", "contextualPricing": { "price": { "amount": "1.0", "currencyCode": "TRY" }, "compareAtPrice": { "amount": "1.0", "currencyCode": "TRY" } } } }, { "node": { "id": "gid://shopify/ProductVariant/48196263280951", "title": "12M", "contextualPricing": { "price": { "amount": "1.0", "currencyCode": "TRY" }, "compareAtPrice": { "amount": "1.0", "currencyCode": "TRY" } } } }, { "node": { "id": "gid://shopify/ProductVariant/48196263313719", "title": "6M", "contextualPricing": { "price": { "amount": "1.0", "currencyCode": "TRY" }, "compareAtPrice": { "amount": "1.0", "currencyCode": "TRY" } } } }, { "node": { "id": "gid://shopify/ProductVariant/48196263346487", "title": "3M", "contextualPricing": { "price": { "amount": "1.0", "currencyCode": "TRY" }, "compareAtPrice": { "amount": "1.0", "currencyCode": "TRY" } } } } ] } } }, "extensions": { "cost": { "requestedQueryCost": 9, "actualQueryCost": 7, "throttleStatus": { "maximumAvailable": 2000, "currentlyAvailable": 1993, "restoreRate": 100 } } } }
I get the value of Price in contextualPricing as 1 TRY, completely different from what I have set in Markets.
Don't know where I'm going wrong, and how I can get the contextualPricing exactly like in Markets.
Thanks, everyone.
Hi,
Maybe you can try to get the market price from storefront api. And there's a setup manual. https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/markets/international...