Hello,
How can I change text “In stock” shown on a product archive to “In stock > 5” if there are more than 5 pieces per product.
I can do that by a hook for a single product page, but that hook doesn’t apply for the product archive. Here is the hook:
add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2);
function custom_get_availability( $availability, $_product ) {
$stock = $_product->get_stock_quantity();
// Change text "In Stock' to 'In stock > 5' when quantity more than 5
if ($_product->is_in_stock() && $stock > 5) {
$availability['availability'] = __('In stock > 5', 'woocommerce');
}
return $availability;
}
The same I need for the product archive, there is still shown only “In stock”. Please see the images for the clarification.
Best Regards
Attachments:
You must be
logged in to view attached files.