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> #980

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

blittle
Copy link
Contributor

@blittle blittle commented Jun 5, 2023

WHY are these changes introduced?

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

WHAT is this pull request doing?

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@@ -128,8 +129,21 @@ export function CartProvider({
data: cart,
cartFragment = defaultCartFragment,
customerAccessToken,
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.

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.

Thanks for adding the tests too. Looks good.

@blittle blittle merged commit b9ab8eb into 2023-04 Jun 5, 2023
10 checks passed
@blittle blittle deleted the bl-fix-cart-provider branch June 5, 2023 22:32
Copy link
Contributor

shopify bot commented Mar 18, 2024

Oxygen deployed a preview of your bl-fix-cart branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
vite ✅ Successful (Logs) Preview deployment Inspect deployment March 18, 2024 3:06 PM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment March 18, 2024 3:06 PM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment March 18, 2024 3:06 PM
optimistic-cart-ui ✅ Successful (Logs) Preview deployment Inspect deployment March 18, 2024 3:06 PM
skeleton ✅ Successful (Logs) Preview deployment Inspect deployment March 18, 2024 3:06 PM
subscriptions ✅ Successful (Logs) Preview deployment Inspect deployment March 18, 2024 3:06 PM

Learn more about Hydrogen's GitHub integration.

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