Skip to content

Change WooCommerce Sold Out text

You can change WooCommerce ‘Sold Out’ text set by the inventory setting of Sold Out with the WooCommerce filter woocommerce_get_availability_text

Add the below snippet with your custom sold text to functions.php

add_filter('woocommerce_get_availability_text', 'themeprefix_change_soldout', 10, 2 );
 /**
  * Change Sold Out Text to Something Else
  */
function themeprefix_change_soldout ( $text, $product) {
    
    if ( !$product->is_in_stock() ) {
        $text = '<div class="alert-info">You missed us - sold out already! If you’d like us to produce more stock then drop us a line and let us know. </div>'; 
        } 
    return $text; 
}

Leave a Comment





Scroll To Top