pixelperfectat/magento2-module-checkout-discount-display
Composer 安装命令:
composer require pixelperfectat/magento2-module-checkout-discount-display
包简介
Per-item discount messages and strikethrough pricing in the cart
README 文档
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
pixelperfectat/magento2-module-checkout-discount-display 适用场景与选型建议
pixelperfectat/magento2-module-checkout-discount-display 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42 次下载、GitHub Stars 达 4, 最近一次更新时间为 2026 年 02 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pixelperfectat/magento2-module-checkout-discount-display 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pixelperfectat/magento2-module-checkout-discount-display 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-11