Last active
September 8, 2020 21:29
-
-
Save xadapter/74c39b5c0af3324fca7876943a5e92ec to your computer and use it in GitHub Desktop.
Snippet to clear the default WooCommerce shipping methods/options on the cart and checkout pages. Supports PluginHive Shipping Plugins: https://www.pluginhive.com/product-category/woocommerce-plugin/woocommerce-shipping/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To test this code, open a private/incognito window, add an item to the cart and then go to cart page. | |
// Once an option is choosen, it will be the default option from that moment onwards. | |
// Code to clear default shipping option. | |
add_filter( 'woocommerce_shipping_chosen_method', '__return_false', 99); | |
// Code to clear default payment option. | |
add_filter( 'pre_option_woocommerce_default_gateway' . '__return_false', 99 ); |
Likewise @ben72, the pre_option_woocommerce_default_gateway
filter doesn't seem to be working anymore 🤔. Can you recall if you found a solution for this?
I have latest woocommerce version 4.x and this filter is not available anymore.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this still work for default gw? Maybe the filter name changed? I can't seem to find it being applied anywhere in WC.
The shipping part works..