WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » [Resolved] Hide Stock Quantity Without Hiding in/out of Stock Status

[Resolved] Hide Stock Quantity Without Hiding in/out of Stock Status

  • Palexandra

    @palexandra

    I have found this snippet to hide the stock quantity without hiding in/out of stock status:

    // Hook in
    add_filter( ‘woocommerce_get_availability’, ‘custom_override_get_availability’, 1, 2);

    // Our hooked in function $availablity is passed via the filter!
    function custom_override_get_availability( $availability, $_product ) {
    if ( $_product->is_in_stock() ) $availability[‘availability’] = __(‘In Stock’, ‘woocommerce’);
    return $availability;
    }

    However, when using this snippet the box to enter the quantity needed also disappears. I need my customers to still be able to select how many they want to order, but maybe receive a message saying “only “x” amount left in stock, please adjust your quantity” or something like that…. is that possible? Event with no message only let them order up to the amount in stock….. Please help!

    http://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Hide Stock Quantity Without Hiding in/out of Stock Status’ is closed to new replies.
Skip to toolbar