[Resolved] Hide shipping method for WOOCOMMERCE

Home Forums Support Hide shipping method for WOOCOMMERCE

  • This topic has 3 replies, 2 voices, and was last updated 1 year ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1242611

    Hello, this is Dave!

    I’m using woocommerce and i wat to make something with the free shipping methods, because woocmmerce shows the “free shipping” and the “standar shipping” when a minimum quantity is reached in a purchase.

    What I want is for the “standard shipping” to disappear when that happens and woocommerce docs that is possible whith a code that you must to add in the functions.php. I haven’t a child theme and don’t want to use if i can use an “element hook”

    This is the documentation:

    And this is the woocommerce code. Can i use this code with a element hook?

    * Hide shipping rates when free shipping is available.
    * Updated to support WooCommerce 2.6 Shipping Zones.
    * @param array $rates Array of rates found for the package.
    * @return array
    function my_hide_shipping_when_free_is_available( $rates ) {
    $free = array();
    foreach ( $rates as $rate_id => $rate ) {
    if ( ‘free_shipping’ === $rate->method_id ) {
    $free[ $rate_id ] = $rate;
    return ! empty( $free ) ? $free : $rates;
    add_filter( ‘woocommerce_package_rates’, ‘my_hide_shipping_when_free_is_available’, 100 );

    Customer Support

    Hi there,

    unfortunately you cannot use Hooks to add that particular code.
    You can add it using the Code Snippets plugin


    Thanks a lot for your quick reply. Maybe i’m going to use this plugin.

    Thank you so much

    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.