0
votes

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;
}
1
If you are selling services why do you need a shipping address? I'm not sure I understand. - helgatheviking
The service involves sending packages. - David

1 Answers

1
votes

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!