• Resolved suporteitpoweron

    (@suporteitpoweron)


    Hello Friends,

    The out of stock visibility option in woocomerce permits to hide all products which reach a certain stock quantity, lets say 1. But suppose having that option applied, still you need to not hide a list of products which reach the quantity 1. I played with the hook pre_option_woocommerce_hide_out_of_stock_items, but I cant get it to work just for a specific product or a list of products, If I activate this snippet then unhides all products and not only the products I want to unhide.

    My code bellow, many thanks in advance for any light provided.

    Júlio

    add_filter( ‘pre_option_woocommerce_hide_out_of_stock_items’, ‘myfunc_hide_out_of_stock_exception’,1,1 );

    function myfunc_hide_out_of_stock_exception( $hide )
    {
    global $product;
    if (is_product())
    {
    if( $product->get_sku() == “0808503010”)
    $hide=’no’;
    return $hide;
    }
    }

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“out of stock visibility” except a list of products’ is closed to new replies.