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

How to Remove the Default Pre-selected Shipping Method on the Checkout Page in WooCommerce?

By default any one of the WooCommerce shipping methods is always pre-selected on both the cart and checkout pages. Do you want to bypass this preselection and always show unselected shipping methods?

The code snippet below will help to clear the default selected shipping methods and show unselected shipping method options on the checkout page. This is beneficial for customers to avoid confusion where they actually forget to input the correct shipping method and also allows customers to make their own choices.

add_action( 'woocommerce_before_checkout_form', 'ts_uncheck_default_shipping_method' );
 
function ts_uncheck_default_shipping_method() {
   WC()->session->set( 'chosen_shipping_methods', null );
   wc_enqueue_js( "
      $( document.body ).one( 'updated_checkout', function() {
         $('input.shipping_method').prop('checked', false);
      });
   " );
}
 
add_filter( 'woocommerce_shipping_chosen_method', '__return_null' );

Output

The output shows that no default shipping method is preselected when the user reaches the WooCommerce Checkout Page.

How to Remove the Default Pre-selected Shipping Method on the Checkout Page in WooCommerce? - Tyche Softwares

The following output shows the shipping method that is preselected by default before implementing the code.

How to Remove the Default Pre-selected Shipping Method on the Checkout Page in WooCommerce? - Tyche Softwares

In contrast to the above functionality, you can also change the default selected shipping method to your preferred shipping method. To know more, check this post that will guide you on how to set default shipping method in WooCommerce cart.

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