• Resolved ctuxboy

    (@ctuxboy)


    Hello,

    Today updating WC to the latest version.
    There are new shipping methods.

    When buying for more then 100€ then is free shipping.
    In the previous version, i have a solution for this.
    I place this code in the functions.php for hiding the ‘flat_rate’ shipping:

    function hide_shipping_when_free_is_available( $rates, $package ) {
    
     	// Only modify rates if free_shipping is present
      	if ( isset( $rates['free_shipping'] ) ) {
    
      		// To unset a single rate/method, do the following. This example unsets flat_rate shipping
      		unset( $rates['flat_rate'] );
    
      		// To unset all methods except for free_shipping, do the following
      		$free_shipping          = $rates['free_shipping'];
      		$rates                  = array();
      		$rates['free_shipping'] = $free_shipping;
    	}
    
    	return $rates;
    }

    In the latest WooCommerce version this function doesn’t work anymore.
    Who can help me find a solution for this?
    (I think it’s another hook for flat_rate shipping)

    Christophe

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WooCommerce disable 'Flat Rate' shipping’ is closed to new replies.