getVariants( )


Gets a product's available variants based on the specified product ID and either option choices or variant IDs.

The getProductVariants() function returns a Promise that is resolved to an array of VariantItem objects when the product variants with the specified choices or variant IDs are retrieved.

Method Declaration
Copy
Method Parameters
productIdstringRequired

ID of the product whose variants are being retrieved. Pass only this field to retrieve all of the specified product's variants.


optionsProductVariantOptions

Variant options to return. If not specified, all the product's variants are returned.

Returns
Return Type:Promise<Array<VariantItem>>
Was this helpful?
Yes
No