This topic has 8 replies, 2 voices, and was last updated 6 years, 6 months ago ago by Rose Tyler
How to hide out of stock products in “Related and Upsell products” blocks?
Hello,
Unfortunately, this is not possible to hide “out of stock” products from these sections.
Regards
It may be possible to add some code in functions.php?
You need to copy related.php file (xstore/woocommerce/single-product folder) to xstore-child/woocommerce/single-product folder and add this code
'meta_query' => array( array ( 'key' => '_stock_status', 'value' => 'instock', 'compare' => '=' ))
https://prnt.sc/jhpa6w
Also, edit xstore-child/woocommerce/single-product/up-sells.php file https://prnt.sc/jhpb65 > https://prnt.sc/jhpc25
$meta_query = array( array ( 'key' => '_stock_status', 'value' => 'instock', 'compare' => '=' ));
Let us know result.
Regards
Everything is working. Thank you.
Also tell me how in the catalog to display “Out of Stock” products at the end. After products “In Stock”.
You’re welcome.
I would recommend you to contact woocommerce support.
Regards
Ok. And how to avoid such a multiplication of pagination?
Please check if this works in the same way with the default WC theme (Storefront).
Let us know.
Regards
You must be logged in to reply to this topic.Log in/Sign up