Skip to content

Instantly share code, notes, and snippets.

@Musilda
Last active November 22, 2020 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Musilda/a84688b8ef4175f66baddebd3055bc5c to your computer and use it in GitHub Desktop.
Save Musilda/a84688b8ef4175f66baddebd3055bc5c to your computer and use it in GitHub Desktop.
<?php
add_filter( 'woocommerce_package_rates', 'musilda_cart_price_free_shipping', 10, 2 );
function musilda_cart_price_free_shipping( $rates, $package ) {
if( 1000 < WC()->cart->get_displayed_subtotal() ) {
foreach($rates as $key => $item){
$rates[$key]->cost = 0;
$rates[$key]->tax = 0;
$rates[$key]->taxes = false;
}
}
return $rates;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment