• Resolved pldoolittle

    (@pldoolittle)


    I have some products that are discontinued, but they still get decent search results. We have set them to “out of stock”, set them to Hidden, and moved them to a special category (Discontinued) that is not displayed anywhere in the shop.

    Is there any way to get them to show up on the special category page, but not on the main page or the search results page.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi @pldoolittle!

    Thank you for reaching out.

    There is no option to do that in WooCommerce core; you would need a plugin or custom coding to achieve it.

    Kindly note that custom coding is outside our scope of support.

    If you already have enabled the Out of stock visibility feature to hide out-of-stock items from the catalog, you can display them on the page you want by adding the following code displayed on this article:

    add_filter( 'pre_option_woocommerce_hide_out_of_stock_items', 'bbloomer_hide_out_of_stock_exception_page' );
     
    function bbloomer_hide_out_of_stock_exception_page( $hide ) {
       if ( is_page( 123 ) ) {
          $hide = 'no';
       }   
       return $hide;
    }

    You would need to change the number 123 with the page number of the special page where you have the out-of-stock products. The page ID or number is the one that displays on the URL when editing the page:


    Image URL: https://i.ibb.co/n802cXZ/knsdgfnasd.png

    You can use a plugin like Code Snippets to add this snippet without having to edit your PHP code.

    I hope this helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Hide product from main page only’ is closed to new replies.