If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

WooCommerce. How to change ‘In Stock’ / ‘Out of Stock’ text displayed on a product page

This tutorial will show how to change ‘In Stock’ / ‘Out of Stock’ text displayed on a product page in WooCommerce templates.

WooCommerce. How to change ‘In Stock’ / ‘Out of Stock’ text displayed on a product page
  1. Log into WordPress admin panel, navigate to Appearance -> Editor tab and open custom-functions.php file for editing:

    WooCommerce. How to Change 'In Stock'  'Out of Stock' text displayed on a product's page -1
  2. Add the following code to the bottom of custom-functions.php file. You can change the Available! and Sold Out text to be whatever you like:

    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;
    }
    
    WooCommerce. How to Change 'In Stock'  'Out of Stock' text displayed on a product's page -2
  3. Go to your site to check Product pages, make sure to refresh the page:

    WooCommerce. How to Change 'In Stock'  'Out of Stock' text displayed on a product's page -3 WooCommerce. How to Change 'In Stock'  'Out of Stock' text displayed on a product's page -4

Feel free to check the detailed video tutorial bellow:

WooCommerce. How to change ‘In Stock’ / ‘Out of Stock’ text displayed on a product page
  • Katie Keith

    Surely if you do this then your change will be lost when you update WooCommerce in future?

    Rating: 5.0. From 1 vote.
    Please wait...
    • Alex Ross

      No, these changes will not be lost upon WooCommerce upgrade.

      No votes yet.
      Please wait...
 
Live Chat
We help you to choose the right product.
Start chat