Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save webdados/0ca0891902c3ecbe887ef3dc8b722c98 to your computer and use it in GitHub Desktop.
Save webdados/0ca0891902c3ecbe887ef3dc8b722c98 to your computer and use it in GitHub Desktop.
Kuanto Kusta for WooCommerce - Set free shipping for products above a certain price
<?php
add_filter( 'kuantokusta_product_node_default_shipping', 'kuantokusta_default_free_shipping', 10, 3 );
add_filter( 'kuantokusta_product_node_variation_shipping', 'kuantokusta_variation_free_shipping', 10, 3 );
function kuantokusta_default_free_shipping( $shipping_cost, $product, $product_type ) {
return kuantokusta_free_shipping( $shipping_cost, $product );
}
function kuantokusta_variation_free_shipping( $shipping_cost, $product, $variation ) {
return kuantokusta_free_shipping( $shipping_cost, $variation );
}
function kuantokusta_free_shipping( $shipping_cost, $product_or_variation ) {
if ( wc_get_price_including_tax( $product_or_variation ) >= 175 ) {
return 0;
}
return $shipping_cost;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment