Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 82367

Disabling Add-to-Cart Button not working

$
0
0

Replies: 0

Hello all. The methods for disabling the add to cart button on he Woocommerce single product page simply aren’t working for me. The below code is a simplified version of what I’m placing in functions/php (neither does it work in woocommerce.php)


function disable_product_if_bought()
{
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 10);
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);

 }

add_action('woocommerce_single_product_summary', 'disable_product_if_bought', 10);

Any thoughts? Thank you.

  • This topic was modified 4 minutes ago by swdpowell.

Viewing all articles
Browse latest Browse all 82367

Trending Articles