Search.../

getQuantity( )

Gets the quantity of a product on the Product Page.

Description

This function is currently only available for Wix Studio sites.

The getQuantity() function returns a Promise that is resolved when the product's quantity is retrieved.

Syntax

function getQuantity(): Promise<number>

getQuantity Parameters

This function does not take any parameters.

Returns

Fulfilled - Product's quantity.

Return Type:

Promise<number>

Was this helpful?

Get the product's quantity

Copy Code
1$w('#myProductPage').getQuantity()
2 .then((productQuantity) => {
3 let numberofBlueShirts = productQuantity; // 128
4 })
5 .catch((error) => {
6 console.error(error);
7 });