定制 pixelperfectat/magento2-module-checkout-discount-display 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 CartItemPrices with regular_price, has_discount, and discount_messages fields
  • Multi-store — all features configurable per store view
  • Translations — included for en_US, de_DE, it_IT, fr_FR, es_ES

Requirements

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

  1. An observer on sales_quote_collect_totals_after iterates visible cart items and attaches discount messages via AbstractItem::addMessage()
  2. Messages are recalculated on every collectTotals() call — no persistent storage needed
  3. A plugin on Magento\Checkout\CustomerData\AbstractItem::getItemData() adds regular_price, regular_price_formatted, and has_discount to section data for the cart drawer
  4. The Hyvä template override renders strikethrough pricing when the regular price differs from the final price

License

MIT

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固