Search.../

resetVariantData( )

Resets the data (such as the price and the weight) of all variants for a given product to their default values.

Description

The resetVariantData() function returns a Promise that resolves when a product's variants have been reset.

Note: The Manage Variants field for the product must be set to true to reset variant data.

Syntax

function resetVariantData(productId: string): Promise<void>

resetVariantData Parameters

NAME
TYPE
DESCRIPTION
productId
string

ID of the product whose variants should be reset.

Returns

Fulfilled - When the variant data are reset. Rejected - Error message.

Return Type:

Promise<void>

Was this helpful?

Reset the data of a variant to their default values

Copy Code
1import wixStoresBackend from 'wix-stores-backend';
2
3export function resetVariantData(productId) {
4 wixStoresBackend.resetVariantData(productId)
5 .then(() => {
6 // product variants have been reset to original values
7 })
8 .catch((err) => {
9 // there was an error resetting the product variants
10 });
11}