Skip to content
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

Items added to the cart or updated within the cart do not maintain the selected currency #1807

Closed
rylanharper opened this issue Feb 29, 2024 · 9 comments
Labels
Storefront API Issues related to https://shopify.dev/docs/api/storefront

Comments

@rylanharper
Copy link

rylanharper commented Feb 29, 2024

Which package or tool is having this issue?

Storefront API

What version of that package or tool are you using?

2024-01

Steps to Reproduce

Go to Hydrogen or any headless shop (Next, Nuxt, Svelte) that uses the Shopify API. Add and item to the cart, change the currency, and then update or add a new item. The currency will default back to the original store currency.

This has been going on for about a week now. This is happening on my Hydrogen store and Nuxt storefront using the Shopify API. This seems to be an API issue.

Expected Behavior

Items added to the cart or updated within the cart should maintain the selected localization currency code

Actual Behavior

Items added to the cart or updated within the cart do not maintain the selected localization currency code. Instead, the item prices revert back to the default store currency.

@blittle
Copy link
Contributor

blittle commented Mar 4, 2024

Hi @rylanharper, I'm sorry about this issue. It's a known problem that we are currently working on. I think a quick fix might be to make sure all queries inContext directive has the proper language/country code.

@blittle blittle added the Storefront API Issues related to https://shopify.dev/docs/api/storefront label Mar 4, 2024
@wizardlyhel
Copy link
Contributor

wizardlyhel commented Mar 4, 2024

If you are using <CartForm> and subfolder i18n strategy, make sure update the route props to also include the locale.

ie:

<Cartform route="/en-gb/cart">

if you are using just the cart handler, you can override the language & country to the same ones being presented to the user.

ie.

cart.addLines(inputs.lines, {
  language: 'EN',
  country: 'GB',
})

As what @blittle mentioned, we are working on this problem, what we suggested is a temporary workaround

@rylanharper
Copy link
Author

@blittle No worries, just wanted to report the issue. Yes, all my cart queries are using inContext, but the issue still persists. Seems to be something within the API core even when the shop local is updated through the localization query.

@wizardlyhel Thanks for this! This does seem to fix some issues in Hydrogen, but the issue is still there for other frameworks utilizing he API through GraphQL.

Appreciate the update from you both:)

@rylanharper
Copy link
Author

Hey all, just checking in on the status of this issue? Not sure if I should implement the temporary solutions (which requires a lot more code) or wait for a fix.

@wizardlyhel
Copy link
Contributor

I don't have an ETA on this but it is being actively worked on.

@rylanharper
Copy link
Author

Okay good to know. Thank you!:)

@wizardlyhel
Copy link
Contributor

@rylanharper I just got word that the fix has rolled out to production. I have verified the fix is on the hydrogen.shop

@MMMPhoto
Copy link

@wizardlyhel We just noticed this issue on our Hydrogen storefront. We recently upgraded to Hydrogen 2024-4-2, but unsure if we were having the error before. Do you know the details of the fix that went out and anything else we can do?

@rylanharper
Copy link
Author

rylanharper commented Jul 12, 2024

@MMMPhoto This is working fine for me in all my headless environments, so its not the API (I am using the 2024-04 release).. Possibly a Hydrogen issue, but I am not using Hydrogen at the moment, so I can't confirm this. It seems to be working fine on the current Hydrogen demo site as well.

I'd recommend opening up a new issue if it persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storefront API Issues related to https://shopify.dev/docs/api/storefront
Projects
None yet
Development

No branches or pull requests

4 participants