Resets the data (such as the price and the weight) of all variants for a given product to their default values.
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.
function resetVariantData(productId: string): Promise<void>;
ID of the product whose variants should be reset.
import wixStoresBackend from "wix-stores-backend";
export function resetVariantData(productId) {
wixStoresBackend
.resetVariantData(productId)
.then(() => {
// product variants have been reset to original values
})
.catch((err) => {
// there was an error resetting the product variants
});
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.