Skip to content

ProductOptions

The ProductOptions container manages and displays product options on the product details page.

ProductOptions configurations

The ProductOptions container provides the following configuration options:

OptionTypeReq?Description
hideSelectedValuebooleanNoHides the selected value of the option.
onValuesfunctionNoA callback function that receives the selected option UIDs.
onErrorsfunctionNoA callback function that receives any errors encountered during option selection.
slotsobjectNoAn object containing slot overrides for the Swatches component.

Example

The following example demonstrates how to configure the ProductOptions container:

slots: {
Swatches: (ctx) => {
const size = ctx.getSlotElement('product-swatch--fashion_size');
// Add link to Sizes
if (size) {
// Create Size Link
const link = document.createElement('a');
link.href = '#';
link.addEventListener('click', (e) => {
e.preventDefault();
console.log('Size Chart');
});
// append inside size
size.appendChild(link);
}
},
},