Search.../

updateProduct( )

Developer Preview

Updates specified fields in a product.

Admin Method

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

Syntax

function updateProduct(_id: string, product: UpdateProduct): Promise<UpdateProductResponse>

updateProduct Parameters

NAME
TYPE
DESCRIPTION
_id
string

Product ID (generated automatically by the catalog).

product
UpdateProduct

Product info to update.

Returns

Return Type:

Promise<
UpdateProductResponse
>
NAME
TYPE
DESCRIPTION
product
Product

Was this helpful?

updateProduct example

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