Site icon Experience Wordpress Developer Online – Design Develop and Maintenance Support

WooCommerce add ‘Free’ after a shipping label

In WooCommerce old version, it display a ‘Free’ label behind any flat shipping rate but in latest version of WooCommerce there is no inbulit functionality. So here i show you how to add ‘free’ label after shipping label.

Add below line of code in your theme’s functions.php file of your active child theme (or theme) and save the file.

function show_free_label_with_free_shipping( $label, $method ) {
//  if ( $method->method_id == 'local_pickup' ) return $label; // Don't apply to local pickup rates
    if ( $method->cost == 0 ) {
        $label .= ' (' . __( 'Free', 'woocommerce' ) . ')';
    }
    return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'show_free_label_with_free_shipping', 10, 2 );
Exit mobile version