Log in
Model

RuleRepository

Magento\SalesRule\Model\RuleRepository

What it does

This repository class manages CRUD (Create, Read, Update, Delete) operations for shopping cart price rules (sales rules) in Magento 2.

Developers use this class to programmatically save, retrieve, search, or delete promotional rules instead of directly working with rule models, ensuring proper data conversion and validation.

It serves as the service layer between the API/business logic and the database operations for cart price rules.

Public Methods

  • save()
  • getById()
  • getList()
  • deleteById()