No results found. Try again with different words?

Search must be at least 3 characters.

Change Woocommerce Out of Stock Text

Sidebar Image

Did not find a solution? We are here to help you succeed.

Astra adds a text “Out Of Stock” for the WooCommerece products that have ‘Stock status’ as out of stock. Below is the screenshot of how the text displays in the front end on the product –

Out of Stock WooCommerce

You can change the “Out Of Stock” text with any custom text you want, on both the Product Catalog (Shop page) and Single Product pages using filters.

For that, you need to add the following filters to the functions.php file of your Child Theme:

  • Add the folowing code to change the “Out Of Stock” text on the Product Catalog (Shop page):
add_filter( 'astra_woo_shop_out_of_stock_string', 'out_of_stock_callback' );
function out_of_stock_callback( $title ) {
return 'SOLD';
}
  • Add the folowing code to change the “Out Of Stock” text on the Single Product pages:
add_filter( 'woocommerce_get_availability', 'change_out_of_stock_text_woocommerce', 1, 2 );
function change_out_of_stock_text_woocommerce( $availability, $product_to_check ) {
// Change Out of Stock Text
if ( ! $product_to_check->is_in_stock() ) {
    $availability['availability'] = __('SOLD', 'woocommerce');
}
return $availability;
}

Both of these codes will replace the “Out Of Stock” text with “SOLD”. You can modify this by replacing the bolded word “SOLD” in both codes with your custom text.

If you don’t have your Child Theme installed, please check this article on how to do it. And, if you are not sure how to add this code, please check this article.

Was this article helpful?
Sidebar Image

Did not find a solution? We are here to help you succeed.

Related Docs

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Membership Retention Checklist Download

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form