Reply 304164 to: Available quantity on shop page

Avatar: Olga Barlow
Olga Barlow
Support staff
October 1, 2021 at 13:49

Hello,

It looks that wc_get_stock_html dislays nothing.
You can try

add_action( 'woocommerce_after_shop_loop_item_title', 'xstore_stock_catalog', 10 );
function xstore_stock_catalog() {
    global $product;
    if ( $product->is_in_stock() ) {
        echo '<div class="et-stock" >' . $product->get_stock_quantity() . __( ' in stock', 'xstore-child' ) . '</div>';
    } else {
        echo '<div class="et-out-of-stock" >' . __( 'out of stock', 'xstore-child' ) . '</div>';
    }
}

Regards

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.