Search.../

updateProductVariants( )

Developer Preview

Updates variants of a specified product.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateProductVariants(_id: string, variants: Array<VariantOverride>): Promise<UpdateVariantsResponse>

updateProductVariants Parameters

NAME
TYPE
DESCRIPTION
_id
string

ID of the product with managed variants.

variants
Array<
VariantOverride
>

Variant info to update.

Returns

Return Type:

Promise<
UpdateVariantsResponse
>
NAME
TYPE
DESCRIPTION
variants
Array<
Variant
>

List of the product's variants.

Was this helpful?

updateProductVariants example

Copy Code
1import { products } from 'wix-stores.v2';
2
3 async function updateProductVariants(id, variants) {
4 try {
5 const result = await products.updateProductVariants(id, variants);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13