Shopify / hydrogen

Hydrogen lets you build faster headless storefronts in less time, on Shopify.
https://hydrogen.shop
MIT License
1.24k stars 246 forks source link

[BUG] Cart doesn't use default Hydrogen localisation #622

Closed Ben4944 closed 11 months ago

Ben4944 commented 1 year ago

Describe the bug The CartProvider localisation defaults to US instead of using the project default from Hydrogen config. Only when on the default site, i.e. not /nz, etc.

To Reproduce

  1. Start demo store
  2. Change defaultCountryCode in Hydrogen config to anything but US
  3. See that this isn't reflected in the cart prices

Expected behaviour Cart country (currency) should be same as that defined in hydrogen.config.ts.

frehner commented 1 year ago

@lordofthecactus is this fixed in CartV2?

juanpprieto commented 1 year ago

@lordofthecactus is this fixed in CartV2?

I believe it is

lordofthecactus commented 1 year ago

It is not fixed. I'm wondering if it makes sense to fix since CartProvider will be independent of hydrogen and it's up to the developer to set the right country for the CartProvider

frehner commented 1 year ago

Shopify/hydrogen-react#42 is another request for this.

[edit: accidentally closed this. Sorry!]

danielmcg1993 commented 1 year ago

Hey all 👋

The merchant who originally reported this issue has reached out again - sheertexsheers

As a result of this problem, the cart elements are consistently being displayed in English, irrespective of the language selected by the user. This language mismatch is impacting the user experience and would greatly appreciate help in resolving this issue.

Internal Dashboard Zendesk Ticket

blittle commented 1 year ago

I'm looking into this.

danielmcg1993 commented 1 year ago

Hey all 👋

Thanks for the work carried out here, the merchant responded with the following soon after making them aware of the fix.

Thank you for your email and for addressing the issues we've been experiencing with the "languageCode" in the GQL cart fragment query. I appreciate your efforts in bringing this matter to the attention of the developers and ensuring it was revisited.

However, upon reviewing the pull request that Shopify merged to address the problem (https://github.com/Shopify/hydrogen/pull/980), it seems that the solution implemented does not align with our requirements. The update no longer requires a country code to be set in the cart and instead pulls the default country code from the "ShopifyProvider" component.

Unfortunately, this does not resolve our language issue since we offer multiple languages within our Shopify storefront, even though the Shopify country code is set to "US." We need a solution that allows us to display the cart elements in the selected language, regardless of the country code.

While it is now possible to add or remove the countryCode in our cart fragment without any issues, there is still no way to set different languageCodes within the same country code. As a side note it is already possible to set this for various parts of our site, such as product detail pages (PDPs), product listing pages (PLPs), and other pages - just not the cart.

We greatly appreciate the work that the developers have put into finding a resolution, and we understand the complexity of the task. However, we kindly request further assistance in finding a solution that aligns with our specific requirements. It is crucial for our customers to have a consistent and localized experience, with cart elements displayed in the selected language, regardless of the country code.

Thank you for your understanding and support throughout this process. We look forward to hearing back from you soon.

They also added in a separate email the following query -

I forgot to ask, is there any news on localizing the checkout flow ?

blittle commented 1 year ago

@danielmcg1993 this is probably a new issue. The previous issue was Hydrogen was forcing the default country code. That has now been fixed. The cart itself was not built to handle languageCode. I'm going back to find context as to why that was the case. But it's probably a separate issue add languageCode functionality.

blittle commented 10 months ago

@danielmcg1993 languageCode is now available on 1.7.1 - https://github.com/Shopify/hydrogen-v1/releases/tag/%40shopify%2Fhydrogen%401.7.1