Created
August 1, 2024 14:42
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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