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.
The following output shows the shipping method that is preselected by default before implementing the code.
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.