WooCommerce: Rename “Read more” To “Out of stock” @ Shop
VIA BUSINESS BLOOMERS

WooCommerce: Rename “Read more” To “Out of stock” @ Shop

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!

Simple 5, Variable 1 and Variable 2 are out of stock in this example. With the snippet below, “Read more” now shows as “Out of stock”. Much better, huh?

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 CustomizeWoo.com FREE * @author        Rodolfo Melogli * @testedwith    WooCommerce 5 * @donate $9     https://businessbloomer.com/bloomer-armada/ */add_filter( 'woocommerce_product_add_to_cart_text', 'bbloomer_archive_custom_cart_button_text' ); function bbloomer_archive_custom_cart_button_text( $text ) {   global $product;          if ( $product && ! $product->is_in_stock() ) {                 return 'Out of stock';   }    return $text;}

WooCommerce: Rename “Read more” To “Out of stock” @ Shop .