Open qiushihe opened 1 month ago
The issue actually comes from this line: https://github.com/Shopify/hydrogen/blob/main/packages/hydrogen/src/product/VariantSelector.ts#L179. As you can see, that regular expression only matches the en-us
format, and no other formats, despite your own documentations using the abbreviated format.
So, please update that hook so it can support more locale identifier formats: en
, and en_US
as well.
Thanks!
@juanpprieto @blittle should we get the locale from the <VariantSelector>
props optionally? Otherwise, maybe we should consider injecting the locale from the server -- we have it in getLocaleFromRequest
so we could return it in the root loader and put it in a React provider.
@frandiox @benjaminsehl we are talking about introducing a hydrogen provider. This might be another usecase for doing so. the locale from the request could be passed to it.
What is the location of your example repository?
No response
Which package or tool is having this issue?
Hydrogen
What version of that package or tool are you using?
latest
What version of Remix are you using?
No response
Steps to Reproduce
en-us
, use justen
which is what the guide uses)/en/products/my-product
)Expected Behavior
The variant selection for both variants should be preserved through URL parameters.
Actual Behavior
Only the selected variant option is preserved.