Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
As a developer wanting to export this information in a timely manner, since the deprecation of presentment prices via the Rest API and the move to the internationalisation, being able to obtain multi-currency values via any has become a challenge.
Not knowing enough of the capabilities of the Storefront API GraphQL query model, I'm looking for some best practise guidance to export this data. If for a given storefront that supports multiple currencies, if I make a request for the min/max prices, all i get returned is the base price currency. See GraphQL #1 below.
So far, I have only been successful in getting all the currency prices when i specifically target a variant, then I can query for the presentmentPrices. See GraphQL #2 below. This is not remotely feasible as a long term strategy. It would take far too long to query for this information.
We have tired using the base currency, and use the currencies.js as an alternative, however this returns inconsistent results.
https://cdn.shopify.com/s/javascripts/currencies.js
Are webhooks the option and the only way to stay consistent. If so, subscribers get notified when mass prices change when FX are updated.
I cannot find any simple solution documented, and it's a common question I see in Stack overflow etc..
Surely there is a more optimal and accurate solution, or have Shopify deliberately taken this step to make it harder for 3rd party services to integrate efficiently.
Welcome for any advice/pointers.
Examples:
{
products( first: 10) {
edges {
node {
id
priceRangeV2{
maxVariantPrice{
amount
currencyCode
}
minVariantPrice{
amount
currencyCode
}
}
}
}
}
}
{
productVariant(id: "gid://shopify/ProductVariant/1234") {
presentmentPrices(first: 30) {
pageInfo {
endCursor
hasNextPage
hasPreviousPage
}
nodes {
price {
amount
currencyCode
}
compareAtPrice {
amount
}
}
}
}
}