Per-Item Discount Messages and Strikethrough Pricing for the Magento 2 Cart
A customer adds 5 items to their cart. Two items are on special price. They apply a coupon. The coupon works on 3 items but not the 2 that are already discounted.
What does the customer see? A total discount number. No explanation of which items were excluded, or why. No strikethrough pricing to show the savings on the items that did get the discount.
This leads to support tickets asking why the coupon didn’t work. It leads to cart abandonment when customers assume the coupon is broken. And it misses the chance to show customers how much they’re saving on the items where it did work.
What the module adds
PixelPerfect Checkout Discount Display adds three things to the cart.
Strikethrough pricing: the regular catalog price appears crossed out next to the discounted price on each line item. Clear visual confirmation of the saving.
Per-item discount messages that explain what happened:
- "10% coupon discount applied (–€5.00)"
- "Coupon not applied — this item already has a special price"
- "Affiliate discount: –€3.00"
Cart drawer support: price data is added to Magento’s customer section data, so if you’re using a Hyvä cart drawer or any AJAX mini-cart, strikethrough pricing works there too. Fully FPC-compatible.
How it works technically
The module hooks into sales_quote_collect_totals_after and calculates messages on every collectTotals() call. No persistent storage, no database changes — messages are computed from the quote state on the fly.
For headless or PWA setups, the GraphQL schema is extended:
{
cart(cart_id: "...") {
items {
prices {
regular_price { value, currency }
has_discount
discount_messages
}
}
}
}
Configuration
Under Stores → Configuration → Sales → Checkout Discount Display you can enable or disable discount messages and strikethrough pricing independently, per store view.
Requirements
PHP 8.3+, Magento 2.4.7+, and the PixelPerfect Discount Exclusion module as a required dependency. Hyvä Theme for the cart page template (GraphQL works regardless of frontend). Amasty Affiliate is optional, for affiliate discount messages.
Translations included for English, German, French, Spanish, and Italian.
The bigger picture
This module is the display layer for the Discount Exclusion module. One controls what discounts apply, the other shows the customer why. Together they form a complete solution: the business rules are correct, and the customer understands what happened.
Transparent pricing builds trust. That part is harder to measure but it matters.
GitHub repository here. Open source, MIT licensed. Get in touch if you need help implementing these modules or need something custom built on top.