• Hi

    Before version 2.6, we were using a great snippet that would hide other shipping methods when free shipping was available, BUT kept local pickup visible as an option.

    We’ve just updated and set up the new shipping classes and it’s all good, but of course the old snippet is no longer working. Are there any php gurus who can help us out with a new snippet that will do the same for 2.6?

    Here’s the original working code:

    add_filter( 'woocommerce_package_rates', 'bbloomer_unset_shipping_when_free_is_available', 10, 2 );
    
    function bbloomer_unset_shipping_when_free_is_available( $rates, $package ) {
    
        // Only unset rates if free_shipping is available
        if ( isset( $rates['free_shipping'] ) ) {
       unset( $rates['flat_rate'] );
       unset( $rates['second_rate'] );
        }
    
        return $rates;
    }

    Thanks!

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hide shipping methods when free available, except local pickup’ is closed to new replies.