Search.../

deleteDiscountRule( )

Developer Preview

Deletes a discount rule.

Description

The deleteDiscountRule() function returns a Promise that resolves when the specified discount rule is deleted.

Admin Method

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

Syntax

function deleteDiscountRule(discountRuleId: string): Promise<void>

deleteDiscountRule Parameters

NAME
TYPE
DESCRIPTION
discountRuleId
string

ID of the discount rule to delete.

Returns

Return Type:

Promise<
void
>

Was this helpful?

deleteDiscountRule example

Copy Code
1import { discountRules } from 'wix-ecom-backend';
2
3 async function deleteDiscountRule(discountRuleId) {
4 try {
5 const result = await discountRules.deleteDiscountRule(discountRuleId);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13