• Resolved sindyvand

    (@sindyvand)


    hello

    In my cart (woo commerce) when delivery is free i see 2 options
    – free
    – pay 12 eur

    When delivery is free, i want the option to pay not to appear.

    Kindly help

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • There are some snippets here to do it:
    https://docs.woocommerce.com/document/hide-other-shipping-methods-when-free-shipping-is-available/

    The snippets go in functions.php for your child theme or you can try a snippets plugin.

    Thread Starter sindyvand

    (@sindyvand)

    Hello,

    1- Before adding snippets, clear your WooCommerce cache. Go to WooCommerce > System Status > Tools > WooCommerce Transients > Clear transients
    > DONE
    2- Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.
    DONE

    >> I added the code bellow :

    /**
    * 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;
    break;
    }
    }
    return ! empty( $free ) ? $free : $rates;
    }
    add_filter( ‘woocommerce_package_rates’, ‘my_hide_shipping_when_free_is_available’, 100 );

    To the plugging “Code snippets plugin” on the top bar

    My page still shows : free delivery and taxes

    https://vint-riding.com/panier/

    “Sous-total 195,01€ (TTC)
    Expédition
    Livraison gratuite
    Frais de port: 12,00€ (TTC)”

    Kindly have a look

    I am seeing “free delivery” and the option to pay for delivery does not appear. This is what you wanted? Looks good.

    Thread Starter sindyvand

    (@sindyvand)

    A small button “activated” was there
    Everything work
    thanks a lot

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Free delivery’ is closed to new replies.