David
David

Reputation: 1

Woocommerce removes shipping labels from cart and checkout

I am selling services using Woocommerce and have enabled shipping address on checkout using snippet, which works fine.

In order to avoid error on checkout, I have to enable free shipping. I do not want the label Shipping: Free Shipping to be shown on Cart and Checkout. Tried using the following snippet, but it didn't work. Please help.

add_filter( 'woocommerce_cart_shipping_method_full_label', 'remove_shipping_label', 10, 2 );

function remove_shipping_label( $label, $method ) {
$new_label = preg_replace( '/^.+:/', '', $label );

return $new_label;
}

Upvotes: 0

Views: 594

Answers (1)

Michael Vermeulen
Michael Vermeulen

Reputation: 187

You can disable shipping in the woocommerce settings.

To force clients to fill in their adress to ship your products to, copy and paste the following code in to your functions.php file

add_filter( 'woocommerce_cart_needs_shipping_address', '__return_true', 50 );

So basically your free shipping label goes away because you disabled shipping and the costs etc but clients still need to fill in the address fields.

Hope this helps!

Upvotes: 1

Related Questions