pixelperfectat / magento2-module-checkout-discount-display
Per-item discount messages and strikethrough pricing in the cart
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:magento2-module
pkg:composer/pixelperfectat/magento2-module-checkout-discount-display
Requires
- php: ^8.3
- magento/framework: ^103.0
- magento/module-checkout: ^100.0
- magento/module-quote: ^101.0
- magento/module-sales-rule: ^101.0
- pixelperfectat/magento2-module-discount-exclusion: *
Requires (Dev)
- phpunit/phpunit: ^10.0
Suggests
- hyva-themes/magento2-default-theme: Required for cart page strikethrough pricing template
This package is auto-updated.
Last update: 2026-02-11 19:21:52 UTC
README
Per-item discount messages and strikethrough pricing for Magento 2 carts.
Features
- Strikethrough pricing — regular catalog price crossed out next to the discounted price on cart line items
- Discount exclusion messages — explains why an item was excluded from a coupon or why only a partial discount was applied
- Coupon discount messages — shows the coupon discount amount per item
- Affiliate discount messages — shows affiliate-specific discount amounts (requires Amasty Affiliate)
- Cart drawer support — adds price data to customer section data for FPC-compatible cart drawers
- GraphQL support — extends
CartItemPriceswithregular_price,has_discount, anddiscount_messagesfields - Multi-store — all features configurable per store view
- Translations — included for
en_US,de_DE,it_IT,fr_FR,es_ES
Requirements
- PHP 8.3+
- Magento 2.4.7+
- pixelperfectat/magento2-module-discount-exclusion
Optional
- Hyvä Theme — required for cart page strikethrough pricing template
- Amasty Affiliate — enables affiliate discount detection and messaging
Installation
composer require pixelperfectat/magento2-module-checkout-discount-display
bin/magento module:enable PixelPerfect_CheckoutDiscountDisplay
bin/magento setup:upgrade
Configuration
Stores > Configuration > Sales > Checkout Discount Display > General
| Setting | Description | Default |
|---|---|---|
| Enable Discount Messages | Show per-item messages for exclusions, coupons, and affiliate discounts | Yes |
| Enable Strikethrough Pricing | Show regular price crossed out next to discounted price | Yes |
Both settings are configurable at the default, website, and store view level.
GraphQL
The module extends the CartItemPrices type:
{
cart(cart_id: "...") {
items {
prices {
regular_price {
value
currency
}
has_discount
discount_messages
}
}
}
}
How It Works
- An observer on
sales_quote_collect_totals_afteriterates visible cart items and attaches discount messages viaAbstractItem::addMessage() - Messages are recalculated on every
collectTotals()call — no persistent storage needed - A plugin on
Magento\Checkout\CustomerData\AbstractItem::getItemData()addsregular_price,regular_price_formatted, andhas_discountto section data for the cart drawer - The Hyvä template override renders strikethrough pricing when the regular price differs from the final price
License
MIT