Search.../

deleteProduct( )

Deletes an existing product.

Description

The deleteProduct() function returns a Promise that resolves when the product with the given ID is deleted.

Syntax

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

deleteProduct Parameters

NAME
TYPE
DESCRIPTION
productId
string

ID of the product to delete.

Returns

Fulfilled - When the product is deleted. Rejected - Error message.

Return Type:

Promise<void>

Was this helpful?

Delete a product by ID

Copy Code
1import wixStoresBackend from 'wix-stores-backend';
2
3export function deleteProduct(productId) {
4 wixStoresBackend.deleteProduct(productId)
5 .then( () => {
6 // product has been deleted
7 })
8 .catch( (err) => {
9 // there was an error deleting the product
10 });
11}