-
Notifications
You must be signed in to change notification settings - Fork 263
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
Price of lineItem changes once in cart: displays faulty presentment price at checkout #853
Comments
+1 We're also experiencing this issue on a custom storefront with multiple currencies implemented via JS Buy SDK. Storefront currency = USD, presentment currencies = HKD, INR, IDR, JPY, MYR, PHP, SGD, KRW, TWD, THB, VND, AUD, NZD. The problem is not browser-specific, we've reproduced the errant behaviour on Chrome 80+ / Firefox 80+ / Safari 13+ / Edge. In our case, the line item price shown in checkout also does not respect the currency-specific line item price that we've set via CSV upload in the admin (we're using fixed prices by currency, not forex + rounding). Shopify Plus installation. |
+1 I'm also encountering this issue using presentment prices. I did discover the price is correct once the shipping address country is updated to match the selected currency... |
This is a workaround we found which works, and is in production on our eight storefronts. We grab the country code from the response headers (Google Cloud) to prepopulate country : _It's not documented on the JS Buy SDK, but it's possible to pass arguments supported by the Storefront API to the JS Buy SDK as well. Here, the important one is passing buyerIdentity.countryCode to the input argument of CheckoutResource.create. That'll set the customer's initial currency during checkout according to the country specified. This currency might change later based on how the customer fills our their address or other information. Also, it's worth mentioning that you should omit presentmentCurrencyCode when using buyerIdentity.countryCode with input despite the JS Buy SDK documentation. Presentment currencies were deprecated as of July 2021, and it seems like the JS Buy SDK documentation is outdated. This tutorial's helpful: https://shopify.dev/custom-storefronts/products/international-pricing#create-a-checkout._ |
@pwamenear thank you so much 🙏 |
We're also struggling with something similar - Is it possible for you to provide some code examples? We've got a site which switches between currencies in a headless/Gatsby setup - We currently use this methodology:
This created a webURL which shows the correct currency on the shopify hosted checkout page. But when querying the checkout to populate our own "cart", we don't have the prices in the correct currency. |
@birksy89 sure thing:
It doesn't use the currency code, but the country code — so in this case you would need "US" or "GB" |
Hey @moreguppy Thanks for the reply, I'm working with @birksy89 on this 🙂 This seems like a better way of doing it, because I know they are deprecating presentment prices/currency. However, this doesn't solve the original problem we are encountering. I appreciate it's not clear from what @birksy89 was saying before, but we are attempting to retrieve the line items stored in the checkout. The prices in the checkout are correct based on the currency/buyer identity, but they don't seem to update on the line items we are pulling to our cart.
Was this something you were experiencing? |
@jamesrice96 I believe the checkout.lineItems object only includes the presentment price that is assigned to the cart when it is initialised... So basically when the user changes currency you have to reinitialise the checkout |
Thanks for taking the time to reply, really appreciate it. We do currently destroy and reinitialise the checkout when the user switches their currency. It's strange because this does update the totalPriceV2 to reflect the customers currency code / buyer identity. However, when we look at the line items, they retain the default currency info. Found this on the shopify docs and looks promising but when you view the response nothing is returned for the line items in their example. https://shopify.dev/custom-storefronts/products/international-pricing#create-a-checkout |
@jamesrice96 no worries! Does that In any case I ended up mapping products to the line items — by literally fetching all the products/variants and matching the variant ids — not the most elegant solution but I wanted to get other product content which wasn't available on the line items. |
@moreguppy sadly not - It shows the first 20 of all the possible prices (100s). We did something similar before, but it feels too hacky. I think there's some bug in play, as the documentation clearly shows what should be happening on this link Yet it's counter to at least what we're getting :( Thanks so much for taking the time, if you think of anything else we'd love to hear it! Our next steps are going to be to write our own query, probably for a "cart" rather than a "checkout" and try and see if we can get to the data outside of using "shopify-buy" SDK. We'll see what we get when querying raw GraphQL... Wish us luck! |
So I managed to work out what is causing this issue, and it's down the the Shopify Buy "Create Checkout" MutationDirect Mutation without
|
Bug details
Describe the bug

Using the SDK on a multi-currency store, the price of the item seems to get distorted once you add a lineItem. To clarify, the price of the product itself is correct, however adding it to the checkout cart will either add or subtract X amount of monies from the cart. For example, adding an item that has the price of $32 set on it, will appear as $37 in the cart. The product price remains unchanged, only cart presentment price is changed. This only happens to non-default currencies.
To Reproduce
Steps to reproduce the behaviour:
Expected behavior
The price of the cart should be consistent with one of lineItem.
Environment (please complete the following information):
Additional context
Other reported bug instances: https://community.shopify.com/c/storefront-api-and-sdks/presentment-prices-don-t-match/td-p/1077596
Bug Report Checklist
The text was updated successfully, but these errors were encountered: