Variant Selector
Renders product option selectors (size, colour, material) and writes the chosen variant to the shared store. Supports Buttons, Swatches, and All modes.
What it does
AP_VariantSelector renders product option selectors for a Shopify product and writes the chosen variant to a shared variant store. It supports three display modes:
- Buttons – renders non-colour options only (e.g. size, material)
- Swatches – renders colour options only, as visual swatches
- All – renders both non-colour buttons and colour swatches together
Swatch colours are sourced directly from Shopify's product swatch API, so you don't need to maintain a manual colour mapping. When a user changes any option, the component resolves the matching Shopify variant using selectedOptions and writes the full variant object to the shared store, including:
- id
- title
- price
- compareAtPrice
- image