ProductWoocommerce

Show product Availability tag in single product page Woocommerce

By default, in the single product page template, there is no option to show an availability tag if the product is available. (by default, it only shows when the product is out of stock).

with this snippet, you can add an “Available” tag, if the product is in stock. (you need to style it y)

    
//display available in single product page function custom_modify_inventory_message( $availability_html, $product ) { // Check if the product is instock and stock management is not active if ( $product->is_in_stock() && ! $product->managing_stock() ) { $availability_html = 'Available' ; } return $availability_html; } add_filter( 'woocommerce_get_availability_text', 'custom_modify_inventory_message', 10, 2 );

Leave a Reply