Section C
Product & collection primitives
The product form store decodes encodedVariantExistence / encodedVariantAvailability to compute which option values exist and are in stock, with no network requests. Collection browsing keeps filters and sort in the URL. Below, the live store state for Keyframe 75 (Midnight/Tactile does not exist; Sand/Tactile is sold out).
Variant selection & product forms
Select options and watch exists / available / selected update symmetrically. The same useProductForm binding powers the PDP and quick view.
- Hydrogen API
createProductComponentsuseProductFormcanAddToCartgetSelectedProductOptionsbuildProductSelectionSearchParams- Data
- Mock catalog (v1-encoded variant matrix)
- Docs
.claude/skills/hydrogen-variant-form/SKILL.md
Loading product…
export const { ProductProvider, useProductForm } = createProductComponents<ProductData>();
<ProductProvider product={product} onSelect={(r) => navigate(variantUrl(product, r.selectedOptions, …), { replace: true, preventScrollReset: true })}>
const { options, selectedVariant, formProps, register } = useProductForm();
<form {...formProps({ beforeSubmit: openCartDrawer })}>
<input type="hidden" {...register("merchandiseId", {})} />
<button {...register("addToCart", {})} disabled={!canAddToCart(product, options)} />
</form>See it in the store:PDP with unavailable combosVariant images
Collection filtering, sorting & pagination
Filters from Storefront API Filter.values[].input, Liquid-compatible params, active chips, price range, a no-JS GET form and load more.
- Hydrogen API
CollectionProvideruseCollectionuseCollectionFormparseCollectionParamsserializeCollectionParamsgetFilterRemovalUrlgetSortByValueisFilterInputActive- Data
- Mock filters (availability, price, type, colour swatches)
- Docs
.claude/skills/hydrogen-collection-browser/SKILL.md
parseCollectionParams(): Storefront API variables
{
"filters": [
{
"price": {
"min": 50,
"max": 200
}
},
{
"available": true
},
{
"productType": "Lamps"
}
],
"sortKey": "PRICE",
"reverse": true
}serializeCollectionParams() round trip + getSortByValue()
{
"serialized": "filter.v.price.gte=50&filter.v.price.lte=200&filter.v.availability=1&filter.p.product_type=Lamps&sort_by=price-descending",
"getSortByValue('BEST_SELLING')": "best-selling",
"getSortByValue('PRICE', true)": "price-descending"
}See it in the store:Desk, filteredSound