Woocommerce Free Shipping If Subscribe
up vote
0
down vote
favorite
I am using the WooCommerce Subscriptions extension and trying to create a rule as follows:
- If user doesn't subscribe to items in cart == Charge shipping.
- If user subscribes to cart == Free shipping.
The code works and applies the shipping discount to the recurring order (£35.00)...However, it does not apply the discount to the initial order (still £38.50):

add_filter( 'woocommerce_cart_calculate_fees', 'add_recurring_postage_fees', 10, 1 );
function add_recurring_postage_fees(WC_Cart $cart ) {
if ( ! empty( $cart->recurring_cart_key ) ) {
$discount = 3.95;
$cart->add_fee( 'You subscribed! Free shipping applied!', -$discount);
return;
}
}
Can't seem to figure out what I'm missing in order to apply the free shipping for BOTH the initial order AND the recurring subscription?
php wordpress woocommerce cart woocommerce-subscriptions
add a comment |
up vote
0
down vote
favorite
I am using the WooCommerce Subscriptions extension and trying to create a rule as follows:
- If user doesn't subscribe to items in cart == Charge shipping.
- If user subscribes to cart == Free shipping.
The code works and applies the shipping discount to the recurring order (£35.00)...However, it does not apply the discount to the initial order (still £38.50):

add_filter( 'woocommerce_cart_calculate_fees', 'add_recurring_postage_fees', 10, 1 );
function add_recurring_postage_fees(WC_Cart $cart ) {
if ( ! empty( $cart->recurring_cart_key ) ) {
$discount = 3.95;
$cart->add_fee( 'You subscribed! Free shipping applied!', -$discount);
return;
}
}
Can't seem to figure out what I'm missing in order to apply the free shipping for BOTH the initial order AND the recurring subscription?
php wordpress woocommerce cart woocommerce-subscriptions
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using the WooCommerce Subscriptions extension and trying to create a rule as follows:
- If user doesn't subscribe to items in cart == Charge shipping.
- If user subscribes to cart == Free shipping.
The code works and applies the shipping discount to the recurring order (£35.00)...However, it does not apply the discount to the initial order (still £38.50):

add_filter( 'woocommerce_cart_calculate_fees', 'add_recurring_postage_fees', 10, 1 );
function add_recurring_postage_fees(WC_Cart $cart ) {
if ( ! empty( $cart->recurring_cart_key ) ) {
$discount = 3.95;
$cart->add_fee( 'You subscribed! Free shipping applied!', -$discount);
return;
}
}
Can't seem to figure out what I'm missing in order to apply the free shipping for BOTH the initial order AND the recurring subscription?
php wordpress woocommerce cart woocommerce-subscriptions
I am using the WooCommerce Subscriptions extension and trying to create a rule as follows:
- If user doesn't subscribe to items in cart == Charge shipping.
- If user subscribes to cart == Free shipping.
The code works and applies the shipping discount to the recurring order (£35.00)...However, it does not apply the discount to the initial order (still £38.50):

add_filter( 'woocommerce_cart_calculate_fees', 'add_recurring_postage_fees', 10, 1 );
function add_recurring_postage_fees(WC_Cart $cart ) {
if ( ! empty( $cart->recurring_cart_key ) ) {
$discount = 3.95;
$cart->add_fee( 'You subscribed! Free shipping applied!', -$discount);
return;
}
}
Can't seem to figure out what I'm missing in order to apply the free shipping for BOTH the initial order AND the recurring subscription?
php wordpress woocommerce cart woocommerce-subscriptions
php wordpress woocommerce cart woocommerce-subscriptions
edited yesterday
LoicTheAztec
77.6k125991
77.6k125991
asked Apr 15 at 0:16
Giuls
259111
259111
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49837375%2fwoocommerce-free-shipping-if-subscribe%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password