Skip to content

Instantly share code, notes, and snippets.

@rashmimalpande
Created October 8, 2018 06:26
Show Gist options
  • Select an option

  • Save rashmimalpande/cf33420dc69073ed6b2e2b9d1ddeddb5 to your computer and use it in GitHub Desktop.

Select an option

Save rashmimalpande/cf33420dc69073ed6b2e2b9d1ddeddb5 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'woocommerce_is_purchasable', 'woocommerce_hide_add_to_cart_button', 10, 2 );
function woocommerce_hide_add_to_cart_button( $is_purchasable = true, $product ) {
return ( $product->get_id() == 335 ? false : $is_purchasable );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment