Home Forums WoodMart support forum In stock

In stock

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #531476

    Alprio
    Participant

    Hello,

    How can i display in stock beside the price in single product layout, if i have disabled stock management on productσ?
    i have 2 vendors. 1 has quantity , the other one no .
    The one with the quantity , beside the price says in stock .
    the one without the quantity just in stock or out of stock beside the price says nothing.
    I want to display in stock beside the price.

    Thank you.

    #531534

    Alprio
    Participant

    ok you can close it.
    Found it

    /// Display “In Stock” or “Out of Stock” for products when stock management is disabled
    add_filter(‘woocommerce_get_availability’, ‘custom_display_stock_status’, 10, 2);
    function custom_display_stock_status($availability, $product) {
    if (!$product->managing_stock()) {
    $availability[‘availability’] = $product->is_in_stock() ? __(‘In Stock’, ‘woocommerce’) : __(‘Out of Stock’, ‘woocommerce’);
    }
    return $availability;
    }

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘In stock’ is closed to new replies.