Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohammadmursaleen/f7be0f84d4b62fed329f76081531de92 to your computer and use it in GitHub Desktop.
Save mohammadmursaleen/f7be0f84d4b62fed329f76081531de92 to your computer and use it in GitHub Desktop.
YITH WooCommerce Wishlist - disable add to cart if no price for Product
<?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