Search...
getSelectedChoices( )
Gets the selected product option choices 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 selected product option choices, such as {color: "white", size: "m"} are retrieved.
Syntax
function getSelectedChoices(): Promise<Object>
getSelectedChoices Parameters
This function does not take any parameters.
Returns
Fulfilled - An object with key:value pairs representing the selected product option choices. Each pair is a product option created in the Products tab of the dashboard. Each key corresponds to an option name, and its values correspond to the choices for this option. For example, {color: "white", size: "m"}
.
Return Type:
Promise<Object>
Was this helpful?
Get the selected product option choices
Copy Code
1$w('#myProductPage').getSelectedChoices()2 .then((selectedChoices) => {3 let selectedProductChoices = selectedChoices; // {color: "white", size: "m"}4 })5 .catch((error) => {6 console.error(error);7 });