Created
March 30, 2017 11:33
-
-
Save mohammadmursaleen/f7be0f84d4b62fed329f76081531de92 to your computer and use it in GitHub Desktop.
YITH WooCommerce Wishlist - disable add to cart if no price for Product
This file contains hidden or 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( 'woocommerce_loop_add_to_cart_link' , 'mm_disable_add_to_cart_if_no_price' , 20 , 2 ); | |
function mm_disable_add_to_cart_if_no_price( $html , $product ){ | |
$product_price = $product->get_price(); | |
if( !empty( $product_price ) || !is_page('wishlist') ){ | |
return $html; | |
} else { | |
echo '' ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment