If you are using Woocommere to sell service or anything that is not physical then you might want to change the ‘Out of Stock’ text to ‘Sold out’ or some other more meaningful words. Before i do the changes, i thought changing the ‘out of stock’ text is just a easy peasy work but end up cannot find the template. Then i only realise it might be control by a hook. After going thru the woocommerce hook documentation, and i found the answer there!

To change ‘Out of Stock’ text in Woocommerce, follow the steps below:-
Advertisements
- First open your theme functions.php file, copy and paste the code below at the bottom of your file.
/** * Change Out of Stock text to Sold out * hook: woocommerce_get_availability - filter */ add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2); function custom_get_availability( $availability, $_product ) { // you can change the 'Sold Out!' to any other text you like if ( !$_product->is_in_stock() ) $availability['availability'] = __('Sold Out!', 'woocommerce'); return $availability; } - Now refresh your Woocommerce product page and you will no longer see the ‘Out of stock’ text. Instead you will see ‘Sold out’
happy selling!
Related posts:
How to add user custom field in My Account page in Woocommerce?
How to enable sidebar on product details page in Virtue Theme
Virtue Theme: How to enable slider in shop page?
How to remove #more tag in WordPress
WordPress: How to open rss links in new window?
Woocommerce: send email to admin when new order place (pending payment)
WordPress Custom Taxonomy Pagination show 404 page not found error
Woocommerce: How to bcc all order email to multiple recipients according to status
Share this with your friends:-
Thank you for this code—it works and I’m so happy! Tried many others but they didn’t work for me.