Documentation

Disable Day Fee When Free Shipping Method is Selected

Add this code snippet to your site and it will disable the day fees when the user selects the Free Shipping method.

You can add this code to the functions.php of your active child theme or you can use the Code Snippet plugin.

<?php
/**
 * Iconic WDS - remove day fees if free shipping is selected.
 *
 * @return void
 */
function iconic_wds_remove_day_fees() {
	global $iconic_wds;

	if ( empty( $iconic_wds ) ) {
		return;
	}

	$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );

	if ( ! isset( $chosen_shipping_methods[0] ) ) {
		return;
	}

	$chosen_shipping_method = $chosen_shipping_methods[0];

	if ( false !== strpos( $chosen_shipping_method, 'free_shipping' ) ) {
		WC()->session->__unset( 'jckwds_day_fee' );
	}
}

add_action( 'woocommerce_checkout_update_order_review', 'iconic_wds_remove_day_fees', 11 );

Are you using WooCommerce Delivery Slots yet?

Start your 14-day free trial right now and get instant access to the features described in this article.

or learn more

Was this helpful?

Please let us know if this article was useful. It is the best way to ensure our documentation is as helpful as possible.

WooCommerce Delivery Slots

WooCommerce Delivery Slots

Not got the plugin yet? Get instant access right now, free for 14 days.

or learn more

Still need help?

If you haven't found what you're looking for in our documentation, please contact support.

Get Support