WordPress.org

Support

Support » How-To and Troubleshooting » Change the "Out of Stock" Text on Main Shop Page

Change the "Out of Stock" Text on Main Shop Page

  • RobJonze

    @robjonze

    Hi,

    I’m a bit stumped on something… how do I change the “Out of Stock” text on the main shop page? We are selling 1 off pieces, and “Out of Stock” doesn’t sound right.

    http://london-calling.com.sg/shop/

    I have added this to my functions:

    add_filter('woocommerce_stock_html', 'change_stock_message', 10, 2);
    function change_stock_message($message, $stock_status) {
        if ($stock_status == "Out of stock") {
            $message = '<p class="stock out-of-stock">Sold</p>';
        } else {
            $message = '<p class="stock in-stock">Available</p>';
        }
        return $message;
    }

    Which works for the single product images, but not for the main page.

    Any help would be much appreciated

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Change the "Out of Stock" Text on Main Shop Page’ is closed to new replies.
Skip to toolbar