none of these is modifying my variable product out of stock message, still displays
This product is currently out of stock and unavailable.
Ive also tried this snippet
// Universal out-of-stock message for all product types (simple, variable, variations)
add_filter('woocommerce_get_availability_text', function($availability, $product) {
if (!$product->is_in_stock()) {
return 'Seems like this product may be only available via special order. Please <a href="/contact/">contact us</a>.';
}
return $availability;
}, 10, 2);
add_filter('woocommerce_get_availability', function($availability, $product) {
if (!$product->is_in_stock()) {
$availability['availability'] = 'Seems like this product may be only available via special order. Please <a href="/contact/">contact us</a>.';
}
return $availability;
}, 10, 2);
and this one too
add_filter('the_content', function($content) {
$search = 'This product is currently out of stock and unavailable.';
$replace = 'Seems like this product may be only available via special order. Please <a href="/contact/">contact us</a>.';
if (strpos($content, $search) !== false) {
$content = str_replace($search, $replace, $content);
}
return $content;
});
Nothing modifies that out of stock product on the variable products that have no price, any ideas?