Namespace: ProductHelpers

ProductHelpers

Methods

(static) variantForOptions(product, options) → {GraphModel}

Returns the variant of a product corresponding to the options given.

Parameters:
Name Type Description
product GraphModel

The product to find the variant on. Must include variants.

options Object

An object containing the options for the variant.

Source:
Returns:

The variant corresponding to the options given.

Type
GraphModel
Example
const selectedVariant = client.product.variantForOptions(product, {
  size: "Small",
  color: "Red"
});