• Resolved MagineM

    (@maginem)


    Hi,

    Just updated my version of WooCommerce to the latest one and now in the cart/checkout I can see all shipping options again. I have a script running in the functions.php that used to hide all shipping if free shipping was available. Anybody have the same problem and perhaps the solution?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Post your snippet, it probably needs an update.

    Thread Starter MagineM

    (@maginem)

    Hi Mike,

    This is the code I was using:

    <?php
    
    /* custom PHP functions below this line */
    // Hide standard shipping option when free shipping is available
    add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );
    
    /**
    * Hide Standard Shipping option when free shipping is available
    *
    * @param array $available_methods
    */
    function hide_standard_shipping_when_free_is_available( $available_methods ) {
    
    if( isset( $available_methods['free_shipping'] ) AND isset( $available_methods['flat_rate'] ) ) {
    
    // remove standard shipping option
    unset( $available_methods['flat_rate'] );
    }
    
    return $available_methods;
    }
    ?>
    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Thread Starter MagineM

    (@maginem)

    Hi Mike,
    I’ve tried the code in the link you supplied but am still having no luck. My old code isn’t working either…

    Thread Starter MagineM

    (@maginem)

    Hi,
    Ok, figured it out. The new code from the link does work, but only once one clears the WC cache:

    WooCoomerce > System Status > Tools > WC Transients > Clear transients

    Perhaps this can be mentioned in that link?

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Will add it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hidden shipping option back after update’ is closed to new replies.