Deals
Module: Magenx_DealGraphQl
Deals turns the Catalog Price Rules you already have into storefront deals: a badge on product cards and the product page, a countdown to the rule’s end date, and a /deals page. A Cart Price Rule can also carry a free gift, or have its coupon code shown on the storefront.
You set everything on the rule itself. No second place stores deal settings, so the price a shopper sees always matches what the cart charges.

How it works
Section titled “How it works”A deal is any active Catalog Price Rule with a Deal Badge Label. The rule still owns everything else:
- Conditions and discount: which products, how much off. The deal price is the product’s real rule-aware final price.
- Schedule: the rule’s From/To dates drive the storefront countdown.
- Scope and priority: websites, customer groups and priority decide who sees the deal, and which rule wins when several match.
Leave the label empty and the rule stays an ordinary price rule with no deal presentation.
Deal types
Section titled “Deal types”| Type | Use it for |
|---|---|
| Deal | Any promotion: flash sale, weekend offer, clearance. The label text is free, for example FLASH SALE. |
| First Order | A new-customer offer. Works together with the customer-group automation below. |
Badge labels per language
Section titled “Badge labels per language”Deal Badge Label is the default text. Under it, Per-Store-View Badge Labels lets you add one row per store view, for example SALE for English and ANGEBOT for German. A store view without a row uses the default label.
Set up a deal
Section titled “Set up a deal”- Go to Marketing > Catalog Price Rules and open or add a rule.
- Set the conditions, discount, dates, websites and customer groups as usual.
- In the Deal Display section, enter a Deal Badge Label and choose the Deal Type.
- Save and apply the rule. The deal shows once the catalog rule index has run.

First-order deals
Section titled “First-order deals”A First Order deal is only a label unless something tracks who is a first-time customer. Magento limits a Catalog Price Rule by customer group, so this module moves customers between groups:
- On registration, a new customer goes into a dedicated first-order group. This covers the storefront, GraphQL and social login. A non-default registration group, such as Wholesale, is never overridden.
- On their first order, the customer moves back to the default group. The first order keeps the discount; later carts don’t get it.
- Create a customer group, for example New Customers, with the same tax class as General.
- In Stores > Configuration > Magenx > Deals > First-Order Deal, enable it and pick the first-order group, the group after the first order, and the default registration group.
- Create a Catalog Price Rule for the New Customers group, with a deal label and Deal Type First Order.
Limits:
- Guests can’t be in a customer group. The offer targets shoppers who register before ordering.
- A cancelled or refunded order does not move the customer back.
- Existing customers with no orders are not moved into the group. The automation only acts from the time you enable it.
Gift deals
Section titled “Gift deals”A Cart Price Rule with a Free Gift SKU adds that product to the cart at price 0 while the rule applies. When the rule stops applying, the gift is removed again. The rule owns the conditions, schedule, scope and coupon.
- Enable Stores > Configuration > Magenx > Deals > Gift Deals.
- Go to Marketing > Cart Price Rules, open a rule, and set Free Gift SKU and optionally Free Gift Quantity (default 1).
- Leave the rule’s Actions conditions empty, so the rule applies to the cart.
- Give the rule a store label. The storefront shows it, for example “Free tote bag with orders over €50”.
- Only simple, virtual and downloadable products can be gifts.
- A shopper can remove the gift. It is then not added again to that cart.
- A gift that can’t be added (unknown SKU, out of stock) is skipped and logged. It never breaks the cart.
- Gift rules with a coupon are never listed on the
/dealspage. Shoppers must know the code.
Coupon deals
Section titled “Coupon deals”A Cart Price Rule with Show on Storefront turned on has its coupon code listed on the storefront:
- On the
/dealspage, a Coupons tab shows one card per code: the rule’s store label, the discount, the dates, a countdown and a Copy code button. - On product pages, a one-line strip under the price shows the first coupon that works on any cart.
The rule still owns the discount, dates, websites, customer groups and usage limits. A code is listed only while all of these are true:
- the rule is active and today is within its dates (the last day counts in full, in the store view’s timezone);
- the rule uses a Specific Coupon without auto generation;
- the shopper’s website and customer group are on the rule;
- the code has uses left.
- Enable Stores > Configuration > Magenx > Deals > Coupon Deals. Deals must be enabled too.
- Go to Marketing > Cart Price Rules and open a rule with a Specific Coupon code.
- Give the rule a store label for each store view, in that store view’s language, for example “Black Friday: 11% off everything”. This is the text shoppers see.
- Turn on Show on Storefront and save.
- Product pages only show coupons whose rule has no conditions and no Actions conditions. A product page never promises a discount the cart would refuse. Coupons with conditions are still listed on the
/dealspage, marked as having conditions. - Auto-generated codes, such as referral welcome coupons, are never listed, even with Show on Storefront on.
- The storefront caches the list for up to 30 minutes, so a change to a rule can take that long to show. A coupon whose end has passed is hidden by the browser straight away.
User flows
Section titled “User flows”Create a deal
- The merchandiser opens a catalog promotion, sets conditions, discount and dates as usual, then a badge label, optional translations and a type.
- Once the promotion is applied, matching products carry the deal for the rule's websites and customer groups.
- Clearing the label turns it back into an ordinary promotion.
See a deal
- A product page, product list or cart asks for each product's deal.
- Products on a deal return label (in the store view's language), type, regular and deal price, percent off, currency and the rule's start and end; others return nothing.
Deals page
- The storefront asks for deal products, optionally of one type, with a page size.
- It gets products currently on a deal for the shopper's website and group, capped at the configured maximum; products no longer visible are skipped.
First-order offer
- A customer registers through any channel. Unless an explicit non-default group was chosen, they join the first-order group.
- A deal scoped to that group and typed First Order shows for them.
- Their first order is placed with the discount; right after placement they move to the configured group, and the offer disappears on the next request.
Free gift
- A merchant sets a gift product and quantity on a cart promotion.
- Whenever the cart changes and the rule applies, the gift line is in the cart at price 0.
- When the rule stops applying, the gift line is removed.
- If the shopper removes the gift, it is not added back to that cart.
- The storefront marks the gift line and can advertise live gift deals that need no coupon.
Coupon deal
- A merchant sets up a cart promotion with a specific code, a discount, dates and a promotion label per store view, and turns on its public flag.
- While the promotion is active, in its dates and its code has uses left, the storefront's coupon list includes it for the promotion's websites and customer groups: code, label in the store view's language, discount type and value, start and end.
- The deals page shows one card per coupon deal with a way to copy the code; a card disappears once its end passes.
- A product page shows the first unconditional coupon deal, in promotion priority order, under the price.
- The shopper enters the code in the cart and the promotion applies as usual.
- Turning the public flag off, deactivating the promotion or using up its code removes it from the list.
These always hold:
- A product's deal price equals what the cart charges for the same website and customer group.
- A deal shows only to the websites and customer groups its rule targets.
- A gift line is in a cart if and only if its rule applies and the shopper has not declined it.
- A gift line is never charged.
- A coupon code is shown only when the merchant made its promotion public.
- A product page never shows a coupon that needs a cart or product condition.
- Winning deal = the matching labelled rule with the highest priority.
- Percent off comes from actual prices, not from the rule amount (rules can stack).
- Deals page size = min(requested, maximum).
- A promotion's last day counts in full: its code is listed until the end of that day in the store view's timezone.
- After a first order, the first-order deal disappears on the next request without a reindex.
Edge cases
Section titled “Edge cases”| Situation | What happens |
|---|---|
| No labelled rule in the store. | Product deal lookup does no further work. |
| Two labelled rules match one product. | Higher priority wins. |
| Promotions not applied yet. | Empty list and no deals; no error. |
| Deal product is an invisible variant or disabled. | Empty item. |
| Customer registers into a wholesale group. | Not moved to the first-order group. |
| Gift product needs options. | Skipped and logged; cart saves. |
| Shopper also buys the gift product. | Two lines: paid line and 0-priced gift line. |
| Shopper changes the gift quantity. | Rule quantity restored. |
| Shopper removes the gift, then adds items. | Gift not added back. |
| Coupon that triggers the gift is removed. | Gift line removed. |
| Store view without a label override. | Default label. |
| Public flag on a promotion with generated codes. | Not listed. |
| Public flag on a promotion without a coupon. | Not listed. |
| Code has used up its uses. | Not listed. |
| Promotion starts tomorrow, or ended yesterday. | Not listed. |
| Promotion for wholesale only; a guest asks. | Not listed. |
| Public promotion with a minimum subtotal condition. | Listed on the deals page as conditional; not shown on product pages. |
| Cached list still holds a coupon whose end has passed. | Hidden by the storefront. |
| Promotion without a label. | Listed with an empty label; the storefront shows a generic text. |
Who it applies to
Section titled “Who it applies to”- Deals: any shopper within the rule's websites and groups.
- First-order offers: customers who register before ordering.
- Gift deals: any cart where the rule applies; advertised only when no coupon is needed.
- Coupon deals: any shopper within the promotion's websites and groups; on product pages, only unconditional ones.
Out of scope
Section titled “Out of scope”- Matching products or computing prices (the promotion engine stays the source of truth).
- First-order offers for guests who register at checkout.
- Restoring first-order eligibility after a cancelled first order.
- Gifts that need options (configurable or bundle products), or a choice of gifts.
- Advertising gift promotions that need a coupon.
- Listing coupon codes issued one per customer, or any code the merchant has not made public.
- Matching coupons to individual products; product pages show only coupons that need no condition.
- A coupon description separate from the cart promotion's per-store-view label.
- Showing public coupons next to the coupon field in the cart.
Install
Section titled “Install”composer require magenxcommerce/module-deal-graph-qlbin/magento module:enable Magenx_DealGraphQlbin/magento setup:upgradebin/magento setup:di:compile # production mode onlybin/magento cache:flush- PHP
~8.4.0||~8.5.0, Magento 2.4.8.
Configuration
Section titled “Configuration”Stores > Configuration > Magenx > Deals
General
Deals are ordinary Catalog Price Rules with a "Deal Display" label + type set on the rule. The rule owns the conditions, actions (discount), schedule and scope; this module surfaces the labelled ones on the storefront. When disabled the deals query returns empty and no product deal badge is resolved.
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enable Dealsmagenx_deal/ | Yes | Store view | Yes/No. |
Maximum Products on the Deals Pagemagenx_deal/ | 48 | Store view | Text. Shown when Enable Deals = Yes. Caps how many products the deals query returns. |
First-Order Deal (Customer Group Automation)
Makes a First Order deal type actually track first-time customers. New registrations are placed in a dedicated customer group (any channel: storefront, GraphQL, social login); once they place their first order they are moved back to the default group. Scope a Catalog Price Rule to the group below and label it as a First Order deal, and its badge/price will show only until the customer's first order. Note: guests can't be in a group, so this targets shoppers who register before ordering.
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enable First-Order Group Automationmagenx_deal/ | No | Store view | Yes/No. |
First-Order Customer Groupmagenx_deal/ | empty | Store view | Dropdown. Shown when Enable First-Order Group Automation = Yes. New customers are placed here. Scope your first-order Catalog Price Rule to this group. Use its own group (not General), and give it the same tax class as General. |
Group After First Ordermagenx_deal/ | General | Store view | Dropdown. Shown when Enable First-Order Group Automation = Yes. Customers are moved to this group once they place their first order (usually General). |
Default Registration Groupmagenx_deal/ | General | Store view | Dropdown. Shown when Enable First-Order Group Automation = Yes. Only registrations with this (or no) group are auto-assigned, so an explicit group such as Wholesale is never overridden. Usually General. |
Gift Deals (Free Gift with a Cart Price Rule)
Set a Free Gift SKU on a Cart Price Rule and, while that rule applies to a cart, the product is added at price 0 and removed again when the rule stops applying. The rule owns the conditions (e.g. subtotal, products in cart), schedule, website/customer-group scope and coupon; its store label is shown as the gift's label. Leave the rule's Actions conditions empty so it applies to the cart. The shopper may remove the gift; it is then not re-added to that cart. Only simple, virtual and downloadable products can be gifts.
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enable Gift Dealsmagenx_deal/ | No | Store view | Yes/No. Off: gift SKUs on rules are ignored and any gift already in a cart is removed on its next change. |
Coupon Deals (Coupon Codes on the Storefront)
Lists the coupon codes of Cart Price Rules that have Show on Storefront ticked, on the deals page and, when the rule has no conditions, on product pages. Only a rule with one Specific Coupon code qualifies (auto-generated codes are never listed), and only while it is active, in its dates, for the shopper's website and customer group, and its code has uses left. The rule's store label is the coupon's text, so give it one per store view.
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enable Coupon Dealsmagenx_deal/ | No | Store view | Yes/No. Off: no coupon is listed, whatever the rules say. Requires Enable Deals. |
Admin permissions
Section titled “Admin permissions”Grant these under System > Permissions > User Roles > Role Resources:
| Resource | Under | ID |
|---|---|---|
| Deals Section | Stores > Settings > Configuration | Magenx_DealGraphQl::config |
GraphQL
Section titled “GraphQL”The storefront reads deals, giftDeals and couponDeals on the /deals page, reads couponDeals on the product page, and selects deal on product cards and the product page. ProductInterface.deal is safe on listing grids: it is resolved for a whole page of products at once.
Queries
deals(type: DealType, pageSize: Int): DealsProducts currently on a deal (a standard deal or a first-order offer) — i.e. matched by an active, labelled Catalog Price Rule for the request's website + customer group.
| Argument | Type | Description |
|---|---|---|
type | DealType | Restrict the list to products matched by a deal of this type. Omit for every active deal. |
pageSize | Int | How many deal products to return (capped at the store's configured limit). |
giftDeals: [GiftDeal!]!Gift deals live now for the request's website + customer group: Cart Price Rules without a coupon that add a free product while they apply. Empty when deals or gift deals are disabled.
couponDeals: [CouponDeal!]!Coupon codes the merchant marked "Show on Storefront", usable now for the request's website + customer group: Cart Price Rules with one specific coupon code, active, in their dates, with uses left. Auto-generated codes are never listed. Ordered by rule priority, at most 20. Empty when deals or coupon deals are disabled.
Fields added to Magento types
| Field | Type | Description |
|---|---|---|
ProductInterface.deal | DealInfo | The active deal (a labelled Catalog Price Rule) matched to this product for the request's website + customer group, or null when the product is on no deal (or deals are disabled). Backed by the indexed Catalog Price Rule and cached per request, so it is safe on listing grids. |
CartItemInterface.deal_gift | DealGift | Set when this line is a free gift added by a gift deal (Cart Price Rule); null for an ordinary line. The line is priced 0 and its quantity is fixed by the rule. Removing it keeps it out of this cart. |
StoreConfig.deals_enabled | Boolean | Whether the deals feature is enabled for the store. |
Types
type Deals - A list of products currently on a deal.
| Field | Type | Description |
|---|---|---|
items | [DealItem!]! | The deal products. |
total_count | Int | The number of deal products returned. |
type DealItem - A single product on a deal.
| Field | Type | Description |
|---|---|---|
product | ProductInterface | The deal product. Null if it is no longer available. Its `deal` field carries the rule metadata (label, type, price, schedule). |
type DealInfo - The deal a product is currently part of, driven by a labelled Catalog Price Rule.
| Field | Type | Description |
|---|---|---|
label | String! | The badge label set on the rule, e.g. "DEAL" or "FLASH SALE". |
type | DealType! | The classification of the deal, set on the rule. |
discount_type | String | The rule's discount action normalized to "percent" or "fixed" (null for "to fixed/percent" actions). Informational — use percent_off for display. |
discount_value | Float | The rule's discount amount for percent/fixed actions, else null. |
regular_price | Float | The product's regular (pre-rule) price in the store currency. |
deal_price | Float | The product's actual rule-aware final price in the store currency. This is the authoritative price Magento charges — the Catalog Price Rule is the single source of truth, so no separate advertised figure exists. |
percent_off | Float | The effective percentage off, derived from regular_price vs deal_price. |
currency | String | The store currency code for the prices. |
starts_at | String | ISO-8601 start of the rule's active window, or null when open-ended. |
ends_at | String | ISO-8601 end of the rule's active window (drives the storefront countdown), or null when open-ended. |
enum DealType - The kind of merchandising deal a labelled Catalog Price Rule represents.
| Value | Description |
|---|---|
DEAL | A standard deal / promotion — the generic type (its free-text label, conditions and schedule on the rule cover flash sales and special offers). |
FIRST_ORDER | A first-order / new-customer offer. |
type GiftDeal - A free gift added to the cart by a Cart Price Rule while the rule applies.
| Field | Type | Description |
|---|---|---|
rule_id | Int! | The Cart Price Rule id. |
label | String | The rule's store label, e.g. "Free tote bag with orders over €50". Null when the rule has none. |
gift_qty | Int! | How many of the gift product are added. |
ends_at | String | ISO-8601 end of the rule's active window, or null when open-ended. |
product | ProductInterface | The gift product. Null if it is disabled or not visible in the catalog. |
type DealGift - The gift deal a cart line was added by.
| Field | Type | Description |
|---|---|---|
rule_id | Int! | The Cart Price Rule id. |
label | String | The rule's store label. Null when the rule has none. |
type CouponDeal - A coupon code shown on the storefront, from a Cart Price Rule marked "Show on Storefront".
| Field | Type | Description |
|---|---|---|
rule_id | Int! | The Cart Price Rule id. |
code | String! | The coupon code to enter in the cart. |
label | String | The rule's store label for the store view, else its default label, e.g. "Black Friday: 11% off everything". Null when the rule has none. |
discount_type | String | "percent" (off each item), "fixed" (amount off each item) or "cart_fixed" (amount off the whole cart). Null for other actions, such as buy X get Y. |
discount_value | Float | The rule's discount amount for the discount_type: a percentage, or an amount in `currency`. Null when discount_type is null. |
currency | String | The base currency code of the store view, which fixed amounts are in. |
starts_at | String | ISO-8601 start of the rule's first day (store time), or null when open-ended. |
ends_at | String | ISO-8601 end of the rule's last day (store time), or null when open-ended. |
unconditional | Boolean! | True when the rule has no cart conditions and no product conditions, so the code takes off its discount on any cart. Only these are safe to show on a product page. |
Glossary
Section titled “Glossary”| Term | Meaning |
|---|---|
| Catalog promotion | Rule lowering product prices by condition, schedule, website and customer group. |
| Cart promotion | Rule applied to the cart, optionally with a coupon. |
| Deal | An active catalog promotion with a badge label. |
| Deal type | Deal (generic: flash sales, special offers) or First Order. |
| Badge label | Short text on the product ("FLASH SALE"); a default and optional per-store-view overrides. |
| Winning deal | When several deals match a product, the one with the highest priority. |
| Regular price | Price before catalog promotions. |
| Deal price | Price after catalog promotions: what the cart charges. |
| First-order group | Customer group new registrations join until their first order. |
| Gift deal | A cart promotion with a gift product and quantity. |
| Gift line | Cart line added by a gift deal, priced 0, quantity fixed. |
| Declined gift | A gift the shopper removed; not added back to that cart. |
| Specific code | The one coupon code a cart promotion is set up with, shared by every shopper. |
| Generated codes | Coupon codes a cart promotion issues one per customer or per campaign. |
| Public flag | A merchant's choice, per cart promotion, to show its specific code on the storefront. Off by default. |
| Coupon deal | A cart promotion with the public flag and a specific code that can be used now. |
| Unconditional coupon | A coupon deal whose promotion has no cart condition and no product condition, so any cart accepts it. |
| Promotion label | A cart promotion's shopper-facing text: a default and optional per-store-view overrides. |