This code enables you to remove the add to cart button from products on specific product category archive pages.
- You can do this using pure PHP code with a conditional tag for one or more product categories or
- Use ACF with this json file import to add a switch on every Edit Product Category screen & then add PHP code to your child themes functions file or custom functionality plugin.
Installation & Code
There’s 2 steps :
Step 1 – If using ACF, import this .json file and add the 2nd code snippet from the download folder to the end of your child themes functions file or custom functionality plugin.
Step 2 – If NOT using ACF, copy the 1st PHP code snippet from the functions file and add it to your child themes functions file making sure you edit the conditional tag with the slug or slugs for each category you want to target.
Like this for more than 1 category
(array('cat_slug_one','cat_slug_two') ) )
or this for 1 category only
('cat_slug_one') )
You must be logged in to post a comment.