Out of stock products in "Related and Upsell products" blocks.

This topic has 8 replies, 2 voices, and was last updated 6 years, 6 months ago ago by Rose Tyler

  • Avatar: mahom
    mahom
    Participant
    May 14, 2018 at 13:25

    How to hide out of stock products in “Related and Upsell products” blocks?

    Please, contact administrator
    for this information.
    7 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 13:51

    Hello,

    Unfortunately, this is not possible to hide “out of stock” products from these sections.

    Regards

    Avatar: mahom
    mahom
    Participant
    May 14, 2018 at 14:11

    It may be possible to add some code in functions.php?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 14:50

    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

    Avatar: mahom
    mahom
    Participant
    May 14, 2018 at 15:20

    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”.

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 15:30

    You’re welcome.
    I would recommend you to contact woocommerce support.

    Regards

    Avatar: mahom
    mahom
    Participant
    May 14, 2018 at 15:35

    Ok. And how to avoid such a multiplication of pagination?

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 15:56

    Please check if this works in the same way with the default WC theme (Storefront).
    Let us know.

    Regards

  • Viewing 8 results - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.