How to disable add to cart
-
Hi, we have some categories products wich has price, but we dont want to let clients to buy them.
https://woocommerce-1526781-5928971.cloudwaysapps.com/kategorija/audiniai/uzsakomieji/
On single product layout we figure out, but how about archive page? there are still button add to cart if we add prices.
Attachments:
You must be
logged in to view attached files.
Hello,
Try to add the following custom css code in Theme Settings > Custom CSS:
body.term-uzsakomieji .add_to_cart_button,
body.term-uzsakomieji .product_type_simple,
body.term-uzsakomieji .product_type_variable,
body.term-uzsakomieji a.button {
display: none !important;
}
Best Regards,
Hello,
To apply the same rule to multiple categories and their subcategories, you just need to target all the category slugs in the body class.
For example, for this category:
“Romanetes”, You can use this:
body.term-romanetes .add_to_cart_button,
body.term-romanetes .product_type_simple,
body.term-romanetes .product_type_variable,
body.term-romanetes a.button {
display: none !important;
}
Best Regards,
So later we can add any term to this css with subcategories also?
For example by same logic?
body.term- .add_to_cart_button,
body.term-mechanizmas-uzuolaida-sirma .product_type_simple,
body.term-mechanizmas-uzuolaida-sirma .product_type_variable,
body.term-mechanizmas-uzuolaida-sirma a.button {
display: none !important;
}
Hello,
Yes, exactly — you can add any category or subcategory slug the same way.
Just copy the block and replace the slug:
body.term-mechanizmas-uzuolaida-sirma .add_to_cart_button,
body.term-mechanizmas-uzuolaida-sirma .product_type_simple,
body.term-mechanizmas-uzuolaida-sirma .product_type_variable,
body.term-mechanizmas-uzuolaida-sirma a.button {
display: none !important;
}
Best Regards,