Deletes a loyalty coupon.
The deletion of a loyalty coupon does not impact the functionality of the corresponding coupon itself.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function deleteLoyaltyCoupon(_id: string, revision: string): Promise<void>;
ID of the loyalty coupon to delete.
Revision number, which increments by 1 each time the loyalty coupon is updated.
To prevent conflicting changes, the current revision
must be passed when updating the loyalty coupon.
import { coupons } from "wix-loyalty.v2";
import { webMethod, Permissions } from "wix-web-module";
import { elevate } from "wix-auth";
const elevatedDeleteLoyaltyCoupon = elevate(coupons.deleteLoyaltyCoupon);
/* Sample parameter values:
*
* {
* "id": "4f2973ab-b0cf-4259-b46e-33716dc26d73",
* "revision": "2"
* }
*/
export const deleteLoyaltyCoupon = webMethod(
Permissions.Anyone,
async (id, revision) => {
try {
const result = await elevatedDeleteLoyaltyCoupon(id, revision);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
/* Promise resolves to void */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.