Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Hide ‘read more’ buttons for out of stock items

Products that are out of stock still invite customers to read more. It is not clear the product is unavailable until the visitor have viewed the individual product page. This code hides the “read more” button when a product is out of stock.

 * Hide 'read more' buttons for out of stock items 

if (!function_exists('woocommerce_template_loop_add_to_cart')) {

  function woocommerce_template_loop_add_to_cart() {

    global $product;
    if (! $product->is_in_stock() || ! $product->is_purchasable()) return;

   View Raw Code ID: 91013