A user encountered an issue where German market-specific products displayed correctly on collection pages but couldn’t be added to the cart on a Shopify store using Hydrogen Storefront.
Root Cause Identified:
The Hydrogen dev team discovered that while buyerIdentity.countryCode was set to DE (Germany), cart mutation requests were sending an @inContext directive with country code NL (Netherlands) instead. This mismatch prevented market-specific products from being added to the cart.
Resolution:
Adding the country variable to the mutation query resolved the issue. The user confirmed this fix worked.
Additional Finding:
The latest Hydrogen package update is missing the country variable in the addCartLines mutation. The correct implementation should be:
We have 2 markets, Primary and German. The German market has specific products which are not available in the Primary market. Switching from the primary market to the German market works fine and the German specific products show up in the collection page. However we are unable to add one of those products to the cart.
That is indeed strange behaviour - I’m experiencing the same when I try to add products to carts on your store, so I don’t believe it’s browser related. I’ve connected with the Hydrogen dev team here to see if they can provide any additional troubleshooting suggestions. Will report back asap!
We’ve taken a deeper look at this and, while buyerIdentity.countryCode was initially set to DE, all cart mutation requests are sending an @inContext directive country of NL on the Storefront API cart mutation requests.
Can you check your cart route and validate what country context your passing the cart handler as it seems by default to be NL even though product queries are being made in a German context.