I recently updated to WooCommerce 2.6 on my shop and they have updated their shipping system. Before I used this to hide the paid shipping option when an specific order value was reached and free shipping was triggered:
/**
* woocommerce_package_rates is a 2.1+ hook
*/
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
/**
* Hide shipping rates when free shipping is available
*
* @param array $rates Array of rates found for the package
* @param array $package The package array/object being shipped
* @return array of modified rates
*/
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;
}
Although this does not work anymore. I need a new fix and im not really into coding.
Does anyone have a solution to this?
The above solution was from this site:
Hide other shipping methods when FREE SHIPPING is available
I'm guessing that some parameters have changed since they updated the shipping methods.
I hope some one out there knows how to fix this.