How to Delete Cart price rules by id Magento 2?

Cart Price used to give a discount to the customer of the site and If the Cart price rule is expired in the system, You can delete it by Sales rule id.

Required interface to delete cart price rule,
Magento\SalesRule\Api\RuleRepositoryInterface

Use deleteById() function to Delete rule by ID.

You can get the data of sales rule by id,
$ruleId = 1;
$salesRuledata = $this->deleteRuleById($ruleId);

Output:
boolean

Leave a Reply