Skip to main content

useOptimisticVariant

The useOptimisticVariant takes an existing product variant, processes a pending navigation to another product variant, and returns the data of the destination variant. This makes switching product options immediate.

Anchor to selectedVariant
selectedVariant
SelectedVariant
required

The selectedVariant field queried with variantBySelectedOptions.

Anchor to variants
variants
Variants
required

The available product variants for the product. This can be an array of variants, a promise that resolves to an array of variants, or an object with a product key that contains the variants.

<SelectedVariant = >

A new product object where the selectedVariant property is set to the variant that matches the current URL search params. If no variant is found, the original product object is returned. The isOptimistic property is set to true if the selectedVariant has been optimistically changed.



Was this page helpful?