Auto-add free shipping coupon for initial orders only for WooCommerce Subscriptions

Nick

Synopsis

Customer wanted to offer free shipping on any orders of at least $25. Additionally, they wanted any subscription renewals to charge shipping normally – the free shipping should only apply to the initial order.

To solve this, I’ve suggested using a free shipping coupon, which is applied automatically to the cart if it’s $25 or more. The end result is:

  • Free shipping on initial cart (if it is at least $25)
  • Normal shipping charged on any subscription renewals for subscription products purchased.

Step 1 – Create Free Shipping Coupon

  1. Go to WooCommerce > Coupons > “Add coupon”
  2. Create a fixed cart discount named “freeshipping”
  3. Set it to a $0 discount, and click “grants free shipping”
  4. Optionally limit coupon to a $25 minimum

Create a freeshipping coupon

NOTE: For free shipping coupons to work, you have to have a free shipping option set in your shipping settings. Be sure to select “Free shipping requires a valid coupon” for this shipping option.

Step 2: Auto-apply coupon

To auto-apply a coupon to the cart without using a 3rd-party plugin, you can add this snippet to your theme’s functions.php file. This particular snippet is set up to auto-apply on all initial orders of at least $25, but it can be edited as needed to conditionally check for quantities, products, etc.

The end result is a free shipping coupon that is automatically applied to the initial order, but not applied to the recurring cart.