There is an unfortunate (IMO) add to cart button naming on the WooCommerce shop page / category pages / product loops. When an item is out of stock, the “Add to cart” (or “Select options” for a variable product type) button label will turn into “Read more”.
To be honest, that doesn’t really say much to the end customer. It’s quite confusing and doesn’t make much sense.
Today, we’ll see how to change that “Read more” label into something more comprehensible: “Out of stock”. A super easy trick. Enjoy!
PHP Snippet: Rename “Read more” Button Label @ WooCommerce Shop / Category / Loop Pages
Note: take a look at the “Test” product in the screenshot above. That still shows “Read more”, so why’s that? Well, in that case the product is not out of stock, actually – it’s just not purchasable (I entered no regular price for it).
The snippet below will only act on the out of stock products. In case you wish to also include non purchasable items, you also need to run the ! $product->is_purchasable() check inside the function.
/**
* @snippet Read more > Out of stock @ WooCommerce Shop
* @how-to Get tutoraspire.com FREE
* @author Tutor Aspire
* @testedwith WooCommerce 5
* @donate $9 https://tutoraspire.com
*/
add_filter( 'woocommerce_product_add_to_cart_text', 'tutoraspire_archive_custom_cart_button_text' );
function tutoraspire_archive_custom_cart_button_text( $text ) {
global $product;
if ( $product && ! $product->is_in_stock() ) {
return 'Out of stock';
}
return $text;
}