Hi @r1k0,
Thanks much for your support in advance. Actually, I’m working on it and i hope it works. Currently, I’m using this block:
// WooCommerce PHP Filters
// ————————-
// Categories where products are not purchasable (completely blocked)
add_filter(‘woocommerce_is_purchasable’, function($is_purchasable, $product) {
$blocked_categories = array(‘teaser’,’waiting’,’coming’,’adoption’); // fully blocked
if (has_term($blocked_categories, ‘product_cat’, $product->get_id())) {
return false; // disables Add to Cart completely
}
return $is_purchasable;
}, 10, 2);
// Hide stock info for fully blocked categories
add_filter(‘woocommerce_get_stock_html’, function($html, $product) {
$blocked_categories = array(‘teaser’,’waiting’,’coming’,’adoption’); // fully blocked
if (has_term($blocked_categories, ‘product_cat’, $product->get_id())) {
return ”; // hides stock
}
return $html; // stock visible for other categories
}, 10, 2);
// Disable Add to Cart button for ‘one-shot’, ‘send-offer’, ‘guess-value’ everywhere (greyed out)
add_filter(‘woocommerce_loop_add_to_cart_link’, function($button, $product) {
$disabled_categories = array(‘one-shot’,’send-offer’,’guess-value’);
if (has_term($disabled_categories, ‘product_cat’, $product->get_id())) {
$button = ‘‘ . __(‘Add to cart’, ‘woocommerce’) . ‘‘;
}
return $button;
}, 10, 2);
// QuickView / Single Page: Disable Add to Cart button for ‘one-shot’, ‘send-offer’, ‘guess-value’
add_action(‘woocommerce_before_add_to_cart_button’, function() {
global $product;
$disabled_categories = array(‘one-shot’,’send-offer’,’guess-value’);
if (has_term($disabled_categories, ‘product_cat’, $product->get_id())) {
echo ”;
}
});
// Hide Send Offer form in QuickView for ‘send-offer’ category
add_action(‘wp_head’, function() {
if ( is_admin() ) return; // Only for front-end
global $product;
// Make sure $product is set (QuickView often sets it)
if ( isset($product) && has_term('send-offer', 'product_cat', $product->get_id()) ) {
echo '<style>
.quickview-wrapper .woocommerce .send-offer-wrapper {
display: none !important;
}
</style>';
}
}); – If you have a simple and clean snippet to hide the stock message and add to cart button on quickview I will be much appreciated. All work good on single page, but if i deleted the snippet block it will revert and will be shown on the specific categories.
Best regards