So how a title says, I have a multiple product "test" website. And each product have " X in stock " in shop page. My website is filtred by category like "Floors" and "Blinds".
And my question is how to I change and text " X in stock " to imagine "X Boxes in Stock". I want a simple solution to don't affect another products category.
Like Floor's category display: "X Boxes in Stock" And Blind's category display: "X Meters in Stock"
Something like that.
Thank you~!
you can check it with this code
function ak_woocommerce_get_availability( $availability, $product ) {
// Specific categories
$specific_categories = array( 'test', 'test-1' );
if ( $product->is_in_stock() && has_term( $specific_categories, 'product_cat', $product->get_id() ) ) {
$availability['availability'] = __('My custom text', 'woocommerce' );
}
return $availability;
}
add_filter( 'woocommerce_get_availability', 'ak_woocommerce_get_availability', 10, 2 );