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

Make <CartProvider> use country code from <ShopifyProvider> #2521

Merged
merged 3 commits into from
Jun 5, 2023

Conversation

blittle
Copy link
Contributor

@blittle blittle commented Jun 5, 2023

Description

Fix the <CartProvider> to by default pull localization from <ShopifyProvider>. You can still override the countryCode by passing a prop directly to <CartProvider>. Resolves Shopify/hydrogen#622

Additional context


Before submitting the PR, please make sure you do the following:

  • Read the Contributing Guidelines
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123)
  • Update docs in this repository according to your change
  • Run yarn changeset add if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning

Copy link
Member

@benjaminsehl benjaminsehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, makes sense, thanks Bret!

@@ -57,7 +58,7 @@ export function CartProvider({
data: cart,
cartFragment = defaultCartFragment,
customerAccessToken,
countryCode = CountryCode.Us,
countryCode,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thing is we don't default a countryCode in the prop, instead use the shopify provider hook to get the default country code.

@blittle blittle merged commit ca65e24 into v1.x-2022-07 Jun 5, 2023
@blittle blittle deleted the bl-fix-cart-provider branch June 5, 2023 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Cart doesn't use default Hydrogen localisation
3 participants