Log in
Model

CouponRepository

Magento\SalesRule\Model\CouponRepository

What it does

This repository class provides CRUD operations for managing shopping cart price rule coupons in Magento 2.

Developers use it to create, retrieve, update, and delete coupon codes programmatically, with built-in validation to ensure coupons match their associated rule's configuration (manual vs auto-generated).

It implements the CouponRepositoryInterface and handles coupon data persistence through the resource model.

Public Methods

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