/ Published in: PHP
Disable "Add to basket" button for price zero
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Disable Add to basket button for prise zero. function custom_woocommerce_is_purchasable( $purchasable, $product ){ if( $product->get_price() == 0 || $product->get_price() == '') $purchasable = false; return $purchasable; } add_filter( 'woocommerce_is_purchasable', 'custom_woocommerce_is_purchasable', 10, 2 );