Skip to content

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.

The storefront deals page listing discounted products with deal badges
The /deals page on the demo store.

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.

Catalog Price Rule
conditions · discount · dates
+ Deal Badge Label

Catalog rule index

GraphQL
deals · ProductInterface.deal

Storefront
badge · countdown · /deals

TypeUse it for
DealAny promotion: flash sale, weekend offer, clearance. The label text is free, for example FLASH SALE.
First OrderA new-customer offer. Works together with the customer-group automation below.

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.

  1. Go to Marketing > Catalog Price Rules and open or add a rule.
  2. Set the conditions, discount, dates, websites and customer groups as usual.
  3. In the Deal Display section, enter a Deal Badge Label and choose the Deal Type.
  4. Save and apply the rule. The deal shows once the catalog rule index has run.
The Deal Display section on the Catalog Price Rule form
Deal Display fields on a Catalog Price Rule.

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:

  1. 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.
  2. On their first order, the customer moves back to the default group. The first order keeps the discount; later carts don’t get it.
registersplaces first order

First-order group
(sees the deal)

General group
(deal hidden)

  1. Create a customer group, for example New Customers, with the same tax class as General.
  2. 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.
  3. 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.

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.

  1. Enable Stores > Configuration > Magenx > Deals > Gift Deals.
  2. Go to Marketing > Cart Price Rules, open a rule, and set Free Gift SKU and optionally Free Gift Quantity (default 1).
  3. Leave the rule’s Actions conditions empty, so the rule applies to the cart.
  4. 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 /deals page. Shoppers must know the code.

A Cart Price Rule with Show on Storefront turned on has its coupon code listed on the storefront:

  • On the /deals page, 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.
  1. Enable Stores > Configuration > Magenx > Deals > Coupon Deals. Deals must be enabled too.
  2. Go to Marketing > Cart Price Rules and open a rule with a Specific Coupon code.
  3. 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.
  4. 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 /deals page, 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.

Create a deal

  1. The merchandiser opens a catalog promotion, sets conditions, discount and dates as usual, then a badge label, optional translations and a type.
  2. Once the promotion is applied, matching products carry the deal for the rule's websites and customer groups.
  3. Clearing the label turns it back into an ordinary promotion.

See a deal

  1. A product page, product list or cart asks for each product's deal.
  2. 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

  1. The storefront asks for deal products, optionally of one type, with a page size.
  2. 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

  1. A customer registers through any channel. Unless an explicit non-default group was chosen, they join the first-order group.
  2. A deal scoped to that group and typed First Order shows for them.
  3. 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

  1. A merchant sets a gift product and quantity on a cart promotion.
  2. Whenever the cart changes and the rule applies, the gift line is in the cart at price 0.
  3. When the rule stops applying, the gift line is removed.
  4. If the shopper removes the gift, it is not added back to that cart.
  5. The storefront marks the gift line and can advertise live gift deals that need no coupon.

Coupon deal

  1. 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.
  2. 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.
  3. The deals page shows one card per coupon deal with a way to copy the code; a card disappears once its end passes.
  4. A product page shows the first unconditional coupon deal, in promotion priority order, under the price.
  5. The shopper enters the code in the cart and the promotion applies as usual.
  6. 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.
SituationWhat 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.
  • 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.
  • 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.
Terminal window
composer require magenxcommerce/module-deal-graph-ql
bin/magento module:enable Magenx_DealGraphQl
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush
  • PHP ~8.4.0||~8.5.0, Magento 2.4.8.

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.

SettingDefaultScopeNotes
Enable Deals
magenx_deal/general/enabled
YesStore viewYes/No.
Maximum Products on the Deals Page
magenx_deal/general/count
48Store viewText. 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.

SettingDefaultScopeNotes
Enable First-Order Group Automation
magenx_deal/first_order/enabled
NoStore viewYes/No.
First-Order Customer Group
magenx_deal/first_order/new_customer_group
emptyStore viewDropdown. 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 Order
magenx_deal/first_order/restore_group
GeneralStore viewDropdown. Shown when Enable First-Order Group Automation = Yes. Customers are moved to this group once they place their first order (usually General).
Default Registration Group
magenx_deal/first_order/default_group
GeneralStore viewDropdown. 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.

SettingDefaultScopeNotes
Enable Gift Deals
magenx_deal/gift/enabled
NoStore viewYes/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.

SettingDefaultScopeNotes
Enable Coupon Deals
magenx_deal/coupon/enabled
NoStore viewYes/No. Off: no coupon is listed, whatever the rules say. Requires Enable Deals.

Grant these under System > Permissions > User Roles > Role Resources:

ResourceUnderID
Deals SectionStores > Settings > ConfigurationMagenx_DealGraphQl::config

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): Deals

Products 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.

ArgumentTypeDescription
typeDealTypeRestrict the list to products matched by a deal of this type. Omit for every active deal.
pageSizeIntHow 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

FieldTypeDescription
ProductInterface.dealDealInfoThe 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_giftDealGiftSet 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_enabledBooleanWhether the deals feature is enabled for the store.

Types

type Deals - A list of products currently on a deal.
FieldTypeDescription
items[DealItem!]!The deal products.
total_countIntThe number of deal products returned.
type DealItem - A single product on a deal.
FieldTypeDescription
productProductInterfaceThe 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.
FieldTypeDescription
labelString!The badge label set on the rule, e.g. "DEAL" or "FLASH SALE".
typeDealType!The classification of the deal, set on the rule.
discount_typeStringThe rule's discount action normalized to "percent" or "fixed" (null for "to fixed/percent" actions). Informational — use percent_off for display.
discount_valueFloatThe rule's discount amount for percent/fixed actions, else null.
regular_priceFloatThe product's regular (pre-rule) price in the store currency.
deal_priceFloatThe 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_offFloatThe effective percentage off, derived from regular_price vs deal_price.
currencyStringThe store currency code for the prices.
starts_atStringISO-8601 start of the rule's active window, or null when open-ended.
ends_atStringISO-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.
ValueDescription
DEALA standard deal / promotion — the generic type (its free-text label, conditions and schedule on the rule cover flash sales and special offers).
FIRST_ORDERA first-order / new-customer offer.
type GiftDeal - A free gift added to the cart by a Cart Price Rule while the rule applies.
FieldTypeDescription
rule_idInt!The Cart Price Rule id.
labelStringThe rule's store label, e.g. "Free tote bag with orders over €50". Null when the rule has none.
gift_qtyInt!How many of the gift product are added.
ends_atStringISO-8601 end of the rule's active window, or null when open-ended.
productProductInterfaceThe gift product. Null if it is disabled or not visible in the catalog.
type DealGift - The gift deal a cart line was added by.
FieldTypeDescription
rule_idInt!The Cart Price Rule id.
labelStringThe 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".
FieldTypeDescription
rule_idInt!The Cart Price Rule id.
codeString!The coupon code to enter in the cart.
labelStringThe 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_typeString"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_valueFloatThe rule's discount amount for the discount_type: a percentage, or an amount in `currency`. Null when discount_type is null.
currencyStringThe base currency code of the store view, which fixed amounts are in.
starts_atStringISO-8601 start of the rule's first day (store time), or null when open-ended.
ends_atStringISO-8601 end of the rule's last day (store time), or null when open-ended.
unconditionalBoolean!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.
TermMeaning
Catalog promotionRule lowering product prices by condition, schedule, website and customer group.
Cart promotionRule applied to the cart, optionally with a coupon.
DealAn active catalog promotion with a badge label.
Deal typeDeal (generic: flash sales, special offers) or First Order.
Badge labelShort text on the product ("FLASH SALE"); a default and optional per-store-view overrides.
Winning dealWhen several deals match a product, the one with the highest priority.
Regular pricePrice before catalog promotions.
Deal pricePrice after catalog promotions: what the cart charges.
First-order groupCustomer group new registrations join until their first order.
Gift dealA cart promotion with a gift product and quantity.
Gift lineCart line added by a gift deal, priced 0, quantity fixed.
Declined giftA gift the shopper removed; not added back to that cart.
Specific codeThe one coupon code a cart promotion is set up with, shared by every shopper.
Generated codesCoupon codes a cart promotion issues one per customer or per campaign.
Public flagA merchant's choice, per cart promotion, to show its specific code on the storefront. Off by default.
Coupon dealA cart promotion with the public flag and a specific code that can be used now.
Unconditional couponA coupon deal whose promotion has no cart condition and no product condition, so any cart accepts it.
Promotion labelA cart promotion's shopper-facing text: a default and optional per-store-view overrides.