Display Stock Status on Woocommerce Product Page
Today I am sharing the solution for Display Stock Status on Woocommerce Product Page (In Stock or Out of Stock), Add following function to your theme function php file. Please change the text ‘Available!’,’Sold Out’ to your own text like In Stock or Out of Stock something like that what you want to display.
/** For more wordpress tips visit www.creativetweets.com**/ add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2); function wcs_custom_get_availability( $availability, $_product ) { // Change In Stock Text if ( $_product->is_in_stock() ) { $availability['availability'] = __('Available!', 'woocommerce'); } // Change Out of Stock Text if ( ! $_product->is_in_stock() ) { $availability['availability'] = __('Sold Out', 'woocommerce'); } return $availability; }