Disable Purchase for All But 1 WooCommerce Product

Author:

Date:

Swap out the 120 in the code with your product id. You can grab the product id from your products page in admin or hover over the edit product link in your WordPress menu and you’ll see the product id in the bottom of your browser window.

The code disables all products for sale by allowing only the product with ID 120 to be purchased. The add to cart buttons on all other shop page products is disabled and changed to read more so they can’t be added to the cart. On the single product page, products have the add

This is the first part of the article

Disable Purchase for All But 1 WooCommerce Product

wpforms banner