Skip to content

Instantly share code, notes, and snippets.

@pipoulito
Created November 26, 2014 09:43
Show Gist options
  • Select an option

  • Save pipoulito/cc40bf49ed14431d7e33 to your computer and use it in GitHub Desktop.

Select an option

Save pipoulito/cc40bf49ed14431d7e33 to your computer and use it in GitHub Desktop.

Revisions

  1. pipoulito created this gist Nov 26, 2014.
    22 changes: 22 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    Hi !

    hi
    i use woocomerce 2.112 so i tried these two different ways in my function.php but it nothing is called.
    I need to hide my local_pickup options defined in my table rate plug setting if my contains a product with shipping class=="XX"
    Please, I'm lost , thanks a lot

    add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
    function hide_shipping_when_free_is_available( $rates, $package ) {
    mail('myemail', 'yo', $rates);
    print_r($rates);
    return $rates;
    }

    add_filter( 'woocommerce_available_shipping_methods','hide_table_rate_shipping_when_free_is_available' , 10, 1 );
    function hide_table_rate_shipping_when_free_is_available( $available_methods ) {
    mail('mymail', 'yo', $available_methods);
    print_r($available_methods);
    return $available_methods;
    }

    thanks