add_filter('woocommerce_get_stock_html', 'custom_show_stock_for_warehouse_category', 20, 2);
function custom_show_stock_for_warehouse_category($html, $product) {
$protected_slug = 'warehouse';
// Check if product is in the "warehouse" category
if (has_term($protected_slug, 'product_cat', $product->get_id())) {
// Check if password is required (and not yet entered) for this category page
if (post_password_required(get_queried_object_id())) {
return ''; // Hide stock level if password not entered
} else {
return $html; // Show stock level if access granted
}
}
return ''; // Hide stock for all other products
}
https://ugg.website/sitemap-misc.xml
2025-06-04T20:24:27+00:00
https://ugg.website/category-sitemap.xml
2025-06-04T20:24:27+00:00
https://ugg.website/producttags-sitemap.xml
2025-06-04T20:24:27+00:00
https://ugg.website/externals-sitemap.xml
2025-06-04T20:24:27+00:00
https://ugg.website/product-sitemap.xml
2025-06-04T20:24:27+00:00
https://ugg.website/post-sitemap.xml
2020-11-01T08:09:36+00:00
https://ugg.website/page-sitemap.xml
2023-03-17T05:01:46+00:00
https://ugg.website/authors-sitemap.xml
2025-06-04T20:24:27+00:00
https://ugg.website/archives-sitemap.xml
2025-06-04T20:24:27+00:00