Hide Out-stock variation loop on shop, categories, etc.

This topic has 13 replies, 3 voices, and was last updated 2 years, 5 months ago ago by Rose Tyler

  • Avatar: Creatic
    Sergi
    Participant
    June 2, 2022 at 11:57

    Hi,

    I have tried in every way to hide out-of-stock products by default. It has not been possible and I have not found a way either.
    It happens to me with the variable products that appear in the shop but not with the parents, only in the variations loop.

    How can I hide them? With the filter ?stock_status=in_stock if it works.

    Can you help me?

    Thank you

    Please, contact administrator
    for this information.
    12 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 2, 2022 at 13:36

    Hello,

    Thanks for contacting us.
    Unfortunately, WooCommerce does not have option to hide out of stock variations only. Please submit a request about adding a new option for our theme here – https://www.8theme.com/taskboard/

    Regards

    Avatar: Creatic
    Sergi
    Participant
    June 2, 2022 at 14:53

    Hi Rose,

    not only hide variations, I want to hide all non-stock products. Currently it hides me the simple products and the parents of the variations.

    thanks

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 3, 2022 at 11:53

    Hello,

    1) Could you, please, provide us with an example of the variable product that has out-of-stock variations?

    2) As I can see you enabled the option to show variations of the variable product as simple products on the shop page. And you want to hide these out-of-stock simple variations from the shop page if you filter by the stock status, right?

    Regards

    Avatar: Creatic
    Sergi
    Participant
    June 3, 2022 at 17:06

    Yes, the problem is when the option to show variations of the variable product as simple products on the shop page is enabled.

    I want that by default in the entire shop, out-of-stock products are never displayed.

    https://prnt.sc/EDXClGTLbqzO
    https://prnt.sc/38TPu95CGy3u

    Thanks

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 4, 2022 at 13:47

    Hello,

    Please provide URL of the variable product that has out-of-stock variations.
    Also, check FTP access – https://prnt.sc/ZeD9YG-8RM1e , we can’t connect.

    Regards

    Avatar: Creatic
    Sergi
    Participant
    June 13, 2022 at 15:44

    Thanks, re-send data in private content area.

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 13, 2022 at 17:53

    Hello,

    Ok, thank you. What about the variable product link that we also asked about in our previous message?

    Regards

    Avatar: Creatic
    Sergi
    Participant
    June 14, 2022 at 10:09

    Hello,

    What I really want is for out-of-stock products not to appear anywhere.

    Right now if you access any part of the shop you will see that products with the label “AGOTADO” appear. https://resetaccessories.com/shop/?lang=es

    From what I’ve seen, it only happens with variable products that are displayed as simple with the Xstore option.

    It would be great if you could tell me the code of the action so that I can modify the behavior in the functions.php of the child theme, like a

    add_filter( ‘woocommerce_loop_…..

    or

    add_action( ‘woocommerce_product_query…. or anyone, I don’t know which one is right.
    I also want to hide the ones that have a price of 999eur. For this I would use the same hook in functions.php.

    Thanks

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 14, 2022 at 21:25

    Hello,

    I understood your request. I have passed the issue to our developers. I’ll inform you once they fix the problem.

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 15, 2022 at 12:01

    Hello,

    Please clear all cache and check now. Let us know

    Regards

    Avatar: Creatic
    Sergi
    Participant
    June 16, 2022 at 10:45

    Hello,
    Perfect now out-of-stock products do not appear. Thanks!!
    But we have a bigger problem, now the page takes a long time to load each request. It is not operational.

    Where can I see the updated code?

    Thanks

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 16, 2022 at 12:56

    Hello,

    We did some extra conditions to prevent loading out-of-stock variations but we used before and now WordPress transients that allow us to keep values (ids of variations) for some time and not make a new request every time on page load. It means that we make a request only once a day and all other times we return the variations ids (set earlier) from transients.

    More about transients -> https://developer.wordpress.org/apis/handbook/transients/

    xstore/framework/woo.php
    function – etheme_product_variations_excluded

    Regards

  • Viewing 13 results - 1 through 13 (of 13 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.