> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # DeleteLoyaltyEarningRule # Package: loyaltyProgramManagement # Namespace: LoyaltyEarningRules # Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/loyalty-program-management/earning-rules/delete-loyalty-earning-rule.md ## Permission Scopes: Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY ## Introduction Deletes a non-automated earning rule. To delete an automated earning rule, call Delete Automation Earning Rule. To update an earning rule's status instead of deleting it, call Update Loyalty Earning Rule. --- ## REST API ### Schema ``` Method: deleteLoyaltyEarningRule Description: Deletes a non-automated earning rule. To delete an automated earning rule, call Delete Automation Earning Rule. To update an earning rule's status instead of deleting it, call Update Loyalty Earning Rule. URL: https://www.wixapis.com/v1/earning-rules/{id} Method: DELETE # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: id Method parameters: param name: id | type: none | required: true query param name: revision | type: revision | description: Revision of the earning rule. Incremented by 1 each time the earning rule is updated. Pass the latest `revision` when updating to prevent conflicting changes. Return type: DeleteLoyaltyEarningRuleResponse EMPTY-OBJECT {} ``` ### Examples ### Delete earning rule ```curl curl -X DELETE \ 'https://www.wixapis.com/loyalty-earning-rules/v1/earning-rules/eeb9ff42-b24f-4a68-8491-21507508f3f5?revision=2' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.loyaltyProgramManagement.LoyaltyEarningRules.deleteLoyaltyEarningRule(_id, options) Description: Deletes a non-automated earning rule. To delete an automated earning rule, call Delete Automation Earning Rule. To update an earning rule's status instead of deleting it, call Update Loyalty Earning Rule. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: _id Method parameters: param name: _id | type: string | description: GUID of the earning rule to delete. | required: true param name: options | type: DeleteLoyaltyEarningRuleOptions none - name: revision | type: number | description: Revision of the earning rule. Incremented by 1 each time the earning rule is updated. Pass the latest `revision` when updating to prevent conflicting changes. Return type: PROMISE EMPTY-OBJECT {} ``` ### Examples ### deleteLoyaltyEarningRule ```javascript import { earningRules } from '@wix/loyalty'; async function deleteLoyaltyEarningRule(_id,options) { const response = await earningRules.deleteLoyaltyEarningRule(_id,options); }; ``` ### deleteLoyaltyEarningRule (with elevated permissions) ```javascript import { earningRules } from '@wix/loyalty'; import { auth } from '@wix/essentials'; async function myDeleteLoyaltyEarningRuleMethod(_id,options) { const elevatedDeleteLoyaltyEarningRule = auth.elevate(earningRules.deleteLoyaltyEarningRule); const response = await elevatedDeleteLoyaltyEarningRule(_id,options); } ``` ### deleteLoyaltyEarningRule (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { earningRules } from '@wix/loyalty'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { earningRules }, // Include the auth strategy and host as relevant }); async function deleteLoyaltyEarningRule(_id,options) { const response = await myWixClient.earningRules.deleteLoyaltyEarningRule(_id,options); }; ``` ---