getOptionsAvailability( )


Gets the availability of a product based on the specified option choices.

The getProductOptionsAvailability() function returns a Promise that is resolved to a ProductOptionsAvailability object when the product's availability information about the product is retrieved.

The information returned in the selectedVariant and availableForPurchase properties reflects the option choices passed in the choices parameter.

If the specified choices result in the selection of a single product variant, that variant is returned in the selectedVariant property and the availableForPurchase property indicates whether that product variant is available for purchase.

If the choices specified in the choices parameter do not result in the selection of a single product variant, no variant is returned in the selectedVariant property and the availableForPurchase property will be false.

Method Declaration
Copy
Method Parameters
productIdstringRequired

The ID of the product whose availability is being checked.


choicesobjectRequired

Option choices to use when checking the product's availability in the form of an object containing a key:value pair for each product option. For example, if a product has a size option, the key will be something like "Size" and its value will be something like "Large".

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