• Hello,

    My current filter (see below) to unset shipping methods is not working in the current version of WooCommerce. I was wondering whether someone could help me out, since I am not really familiar with Php.

    With kind regards,

    Robin

    // add filter and function to hide method

    add_filter( ‘woocommerce_available_shipping_methods’, ‘custom_shipping_methods’ , 10, 1 );

    function custom_shipping_methods( $available_methods ){

    if ( cart_has_product_with_orange_cats() ) {

    foreach($available_methods as $key => $method){

    if($key == ‘local_pickup’){

    continue;
    }

    unset($available_methods[$key]);

    }

    // remove the rate you want
    }

    // return the available methods without the one you unset.

    return $available_methods;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    You’d best ask this to the Woocommerce team, or in their support/community spaces, here this is more wordpress-centric, while woocommerce is a whole different ship 🙂

    Thread Starter robinjoshua

    (@robinjoshua)

    O I’m sorry! I will try there.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WooCommerce shipping methods filter’ is closed to new replies.