wc-coupon-types-rules
Installation
SKILL.md
WooCommerce coupon types and rules
Keep coupon definition, eligibility, calculation, and usage accounting separate. Let WC_Discounts allocate discounts and let Woo totals calculate tax; do not rewrite cart item prices or totals to imitate a coupon.
Choose the coupon model
| Need | Model |
|---|---|
| Merchant-managed reusable code, native limits/reporting | Persisted WC_Coupon (shop_coupon) |
| Generated code resolved from your own entitlement/table/service | Use wc-coupon-dynamic for a virtual coupon |
| A new mathematical discount behavior visible in the type selector | Custom coupon type from this skill |
| Surcharge or positive adjustment | Use the Woo fee API, not a negative/creative coupon |
| Silent customer-specific product price | Use a pricing rule only when it should not be represented as a coupon/order coupon line |
Create persisted coupons with CRUD
Register custom types before loading or setting them. HPOS does not move coupons into order tables; they remain shop_coupon objects, but integrations should still use WC_Coupon CRUD.