I want Storefront API query cart to return prices in a specific currency (by passing @inContext(country: GB), for example). Instead, it always seems to return prices in the currency associated with customer’s shipping address. Is there any workaround?
====================
To give more context, I’ve got several currencies and locales enabled for my site. I’m using the storefront API to fetch cart information (such as prices). Something like this:
query cart($id: ID!) @inContext(country: GB) {
cart(id: $id) {
id
cost {
totalAmount {
amount
currencyCode
}
}
discountAllocations {
discountedAmount {
amount
currencyCode
}
}
}
}
This works like a charm when customer is not logged in: it returns prices in GBP. As soon as a cart is associated with a customer that has a defined shipping address, query above returns prices in the currency associated with that customer’s shipping address (for example, EUR if the customer default shipping address is in Spain). There is no way of overriding this.
I know that docs state that “International pricing is determined based on the customer’s shipping address and is enforced at checkout”, but how is this useful for a cart query? How can I display cart totals in any currency?