add_filter( 'woocommerce_get_availability', 'custom_get_availability', 10, 2 );
function custom_get_availability( $availability, $product ) {
if ( $product->is_in_stock() && $product->get_stock_quantity() <= 1 ) {
$availability['availability'] = __('Last item remaining', 'woocommerce');
}
return $availability;
}
Reviews
There are no reviews yet.