setono/sylius-coupon-url-application-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

setono/sylius-coupon-url-application-plugin

Composer 安装命令:

composer require setono/sylius-coupon-url-application-plugin

包简介

Apply Sylius promotion coupons via a URL query string or a dedicated /coupon page.

README 文档

README

Latest Version Software License Build Status Code Coverage Mutation testing

Apply coupons by going to example.com/coupon or directly from the URL by going to example.com/?coupon=CODE.

Installation

composer require setono/sylius-coupon-url-application-plugin

Import routing

# config/routes/setono_sylius_coupon_url_application.yaml
setono_sylius_coupon_url_application:
    resource: "@SetonoSyliusCouponUrlApplicationPlugin/config/routes.yaml"

or if your app doesn't use locales:

# config/routes/setono_sylius_coupon_url_application.yaml
setono_sylius_coupon_url_application:
    resource: "@SetonoSyliusCouponUrlApplicationPlugin/config/routes_no_locale.yaml"

Install assets

php bin/console assets:install

How coupon application works

The plugin's main use case is sending coupon links from email campaigns, newsletters, ads, etc. A customer clicks https://example.com/?coupon=CHRISTMAS and the coupon is attached to their cart immediately — even before they have added a single item. As soon as the cart matches the promotion's rules (e.g. a minimum cart total, a required taxon), the discount activates.

To support this flow, the plugin runs the coupon application in two stages:

  1. Coupon-level eligibility (PromotionCouponEligibilityCheckerInterface) — gates whether the coupon is attached at all. This checks the coupon's start/end dates, total usage limit, per-customer usage limit, and channel applicability. If any of these fail, the coupon is rejected with an error flash and not attached to the cart.

  2. Promotion-level eligibility (PromotionEligibilityCheckerInterface) — determines which flash the customer sees after the coupon is attached. This includes the underlying promotion's rules (cart-total threshold, taxon/product allow-lists, etc.):

    • Cart already qualifies → success flash setono_sylius_coupon_url_application.coupon_applied ("The coupon code is now activated in your cart")
    • Cart doesn't qualify yet → info flash setono_sylius_coupon_url_application.coupon_applied_not_fulfilled ("The coupon code is saved in your cart, but the discount is not active yet because your cart does not contain the items, amounts or meet other criteria that the coupon requires…")

This deliberately differs from Sylius's built-in cart coupon widget, which rejects coupons up-front when the cart doesn't satisfy promotion rules. The plugin's leniency is the point — customers should be able to click the link in an email before shopping, not after.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固