WooCommerce Subscriptions provides a couple of coupon types that are specific to subscription type products. These are documented here Subscription Coupons – however, it is often desirable to be able to offer a promotional code that would apply a discount to both a sign-up fee and a recurring discount. The use case would be for listing specials on coupon code sites or specials on groupon, etc. Unfortunately, there is currently no way to combine two different types of discounts into one coupon. At least not out-of-the-box.
WooCommerce Subscriptions hooks into the WooCommerce provided
woocommerce_coupon_get_discount_amount filter to do its magic. One can hook into that same filter but on a lower priority to also apply a different discount type.
Consider a scenario similar to:
- A synced subscription so no payment would be collected at sign-up without a sign-up fee.
- Offer a discount on both the sign-up fee that is used to cover the first installment of the subscription product and for some number of renewals in the future with one coupon code.
Given a coupon code of
recurringandsignupdiscount which may be configured similarly to:
woocommerce_coupon_get_discount_amount filter can be implemented similar to:
To achieve the desired effect of one coupon being used for two discount types.
Not sure what to do with code snippets? See What Do I Do With These Code Snippets?