IMPORTANT: This code is made available in the hope that it will be useful, but without any warranty. See the GNU General Public License included with the code for more details. Automattic or WooCommerce support services are also not available to assist with the use of this code.
Need to offer customers a discount that can only be applied to a manual renewal?
Now you can!
Renewal Only Coupons makes it possible to create WooCommerce Product or Cart coupons that can only be applied to renewal payments, not initial sign-ups, by customers via the cart.
To define the coupon codes that should be renewal only, either:
- Enter the coupon codes via the administration settings screen; or
- Use custom code to set them via the
WCS_RENEWAL_ONLY_COUPON_CODES
constant orwcs_renewal_only_coupon_codes'
filter
Store managers can still apply Renewal Only coupons to any order or subscription. Customers can only apply them to renewal order payments.
Example error when attempting to apply a Renewal Only coupon to a new sign-up:
To create a coupon:
- Go to WooCommerce > Coupons > Add Coupon
- Click Discount Type
- Click either:
- Recurring Product Discount or 1.Recurring Product % Discount
- Complete other coupon fields
Note: For best results, we recommend using either a Recurring Product Discount or Recurring Product % Discount discount type.
These discount types can be applied to subscriptions via the WooCommerce > Edit Subscription administration screen, while others, like Fixed cart or Fixed product discount types can not be applied to subscriptions.
Other discount types may also yield unexpected behaviour, for example, the Sign Up Fee discount type will not discount any part of a renewal payment, because it only discounts the sign-up fee component of an order, of which there is none on a renewal.
- Go to WooCommerce > Settings > Subscriptions
- Scroll to the Renewals section
- Click the Renewal Only Coupons text field
- Enter a coupon code to restrict to renewal payments only
- If additional coupon codes are requireed, enter a comma (
,
) before each additional code
define( 'WCS_RENEWAL_ONLY_COUPON_CODES', array( 'coupon_code_one', 'hallowoon', 'cyber_monday' ) );
function eg_my_renewal_only_coupon_codes( $existing_codes ) {
$existing_codes[] = 'my_new_code';
$existing_codes[] = 'my_other_new_code';
return $existing_codes;
}
add_filter( 'wcs_renewal_only_coupon_codes', 'eg_my_renewal_only_coupon_codes' );
To install:
- Download the latest version of the plugin here
- Go to Plugins > Add New > Upload administration screen on your WordPress site
- Select the ZIP file you just downloaded
- Click Install Now
- Click Activate
To keep the plugin up-to-date, use the GitHub Updater.
This plugin requires:
- PHP 5.6 or newer
- WooCommerce 3.2.0 or newer
- WooCommerce Subscriptions 2.4.0 or newer
If you find an problem or would like to request this plugin be extended, please open a new Issue.