Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Remove Shipping Section from WooCommerce Cart and Checkout Page?

While selling digital downloads there is no need to display shipping options on both cart and checkout pages. Here comes a simple code snippet to achieve this.

add_filter( 'woocommerce_cart_needs_shipping', 'ts_filter_cart_needs_shipping' );
add_filter( 'woocommerce_cart_needs_shipping', 'ts_filter_checkout_needs_shipping' );

function ts_filter_cart_needs_shipping( $needs_shipping ) {
    if ( is_cart() || is_checkout() ) {
        $needs_shipping = false;
    }
    return $needs_shipping;
}

function ts_filter_checkout_needs_shipping( $needs_shipping ) {
    if ( is_checkout() ) {
        $needs_shipping = false;
    }
    return $needs_shipping;
}

Output

The below image represents the shipping information that is removed from the Cart page using the filter function woocommerce_cart_needs_shipping.

How to Remove Shipping Section from WooCommerce Cart and Checkout Page?

In the same way, the output shown below removed the Shipping information from the Checkout page using the same filter hook.

How to Remove Shipping Section from WooCommerce Cart and Checkout Page?

Making a slight change to the above customization, you can replace WooCommerce cart shipping section with a custom text message and this will help you show the shipping options only on the checkout page.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x