Posted By

nbpurohit on 06/09/15


Tagged

wordpress


Versions (?)

Disable "Add to basket" button for price zero


 / Published in: PHP
 

Disable "Add to basket" button for price zero

  1. // Disable Add to basket button for prise zero.
  2. function custom_woocommerce_is_purchasable( $purchasable, $product ){
  3. if( $product->get_price() == 0 || $product->get_price() == '')
  4. $purchasable = false;
  5. return $purchasable;
  6. }
  7. add_filter( 'woocommerce_is_purchasable', 'custom_woocommerce_is_purchasable', 10, 2 );

Report this snippet  

You need to login to post a comment.