• Resolved josul

    (@josul)


    hello,
    Since the update of woocommerce (version 3.3.3), on my variable product pages, the selector of variations disappeared and a message (I do not want this message!) “this product is currently out of stock and unavailable ” is on the page.
    I use Avada theme Version 5.4.2 and woocommerce in mode catalog and with “no management of stocks”.
    I reactivated the version 3.3.0 and everything is OK. (I desactivated the other plugins, I switched to another theme but the probleme is the same)
    Apparently several people have the same problem after the update: the selector of options disappeared and the message appeared because the product is considered as out of stock (the site is in catalog mode)
    Someone found a way : write a price. That way gives the expected result ! But it seems to me a guile and rather absurd because the site is in catalog mode, and too long.
    Maybe, in php language, there is the way to get the same result ? It would be faster (than write a price for each variation of each product) and more appropriate.

    Thank you for giving me a precise answer, if possible.
    (I’m not developer and I just begin to discover php language)

    • This topic was modified 6 years, 8 months ago by josul.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @josul

    This issue is likely a result of any template overrides applied to the Avada theme. Does this issue still occur when you test another theme?

    Thread Starter josul

    (@josul)

    Hi, John
    yes, as I wrote in my post, I switched from my avada child to another theme but it was the same result (as well as I deactivated the other plugins). I tried to write a price for each variation of one product and it was ok for that product only.
    is there any php code (I could put in functions.php in the child theme) to indicate that the stock is always OK ?
    Thanks

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @josul

    I think the problem here is that something is causing this to break. Rather than applying a temporary fix you may want to try switching back to a default theme, specifically Twenty Seventeen or Storefront. After you have done that, try disabling all plugins except for WooCommerce to see if this resolves the issue. If that helps, then re-enable each one at a time until you find the one that’s causing the conflict.

    Let me know what you find.

    Thread Starter josul

    (@josul)

    Hi, John
    I did just as you said : I switched to Twenty Seventeen, then I disabled all the plugins except woocommerce ; this doesn’t resolve the issue. No change at all.
    I’m going to write a price for each variation of each product even if it does not satisfy me.
    If you have another idea, please, tell me !
    Thank you for your help, I appreciate !

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @josul

    That’s so odd. Are the prices missing and the products are missing, or are the products just missing?

    Thread Starter josul

    (@josul)

    hi,
    there was no price because of catalog mode
    the products are not missing ;
    is missing the selector of options which appears because there are variations (of colours)
    but actually on the pages I can see the image, the description of the product but I can’t choose the color because the selector of options (choose an option …) is not visible ; it is replaced by the sentence ““this product is currently out of stock and unavailable”
    I think the probleme is “out of stock”, probleme resolved if I write a price for each variation ( I tested it for one product ; for another product I wrote the price only for one variation and the sentence disappeared but I saw only one variation, that one ; the variations without prices were not visible)
    I hope I managed to explain you clearly.
    I marked “no management of stock” but that is not enough ; there are no prices for the variations, so woocommerce thinks there are no products and write the sentence, and doesn’t write the attributes of colours.
    (It’s very difficult, it’s not easy to use woocommerce)
    thank you

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Right, so that is the expected default behavior now. If a variation has not price, it is not selectable so it’s attributes won’t be shown unless another valid variations used them.

    Particularly has to do with this change: https://github.com/woocommerce/woocommerce/commit/80c07d530d74f551d6a02a2f4588a91f88428928#diff-9d28960c60468fc038da5e6232cf0d8c

    To reverse, you can set the woocommerce_hide_invisible_variations filter to false.

    Thread Starter josul

    (@josul)

    Hi, Caleb

    Thanks for trying to help me !
    I thank you for the link with the code.

    I copied exactly what I saw :
    // Filter ‘woocommerce_hide_invisible_variations’ to optionally hide invisible variations (disabled variations and variations with empty price)
    – if ( apply_filters( ‘woocommerce_hide_invisible_variations’, false, $this->get_id(), $variation ) && ! $variation->variation_is_visible() ) {

    even if something seemed to me strange, may be wrong : After the { I think something is missing, at least }

    So I tried to set the php code in the functions.php file of my children theme but I do not know if I copied what I had to copy – with or without “continue; } after {- because I obtained a completely white page.

    Please, excuse my inexperience in php language !

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    The code that goes into your child theme’s functions.php file will be:

    
    add_filter( 'woocommerce_hide_invisible_variations', '__return_false' );
    
    Thread Starter josul

    (@josul)

    Hi, caleb !
    Thanks very much to you !!!!
    I added the php code and the selector of options is back.

    The sentence was still there. So I added css code and it disappeared.

    I’m glad.

    Only if you have time and if you agree, I would like to ask you some questions (because I like understanding and I would want to progress). Of course, if you agree, answer only the questions you want.

    • the code you pasted, what does it mean ?
      I understand that : when woocommerce is going to hide invisible variations, send to woocommerce a message FALSE so that it doesn’t hide the variations
      Is that right or wrong ?
    • the sentence “this product is currently out of stock and unavailable” was still on the page.
      Why din’t it disappeared after adding php code?
    • Which link (clear, precise, including codes or examples) would allow me to progress in understanding woocommerce?
    • Thank you !
      have a good day

    • This reply was modified 6 years, 8 months ago by josul.
    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    So the filter comes from here: https://github.com/woocommerce/woocommerce/blob/823332b5dbfdab464ec567c89cf7d0ec341a25e0/includes/class-wc-product-variable.php#L289

    When WooCommerce is checking which variations should be shown, it runs through this filter. If it’s set to true (which it is by default), it will skip attributes that have no valid variations. So by setting the filter to false, this remove the “skipping” and they will still show up on the product page.

    And then right, the variation is still considered out of stock because there is no price/stock. It’s not purchasable. Your use case seems a bit odd – why have the user make selections for no apparent reason since they can’t add to cart with those selections?

    And then lastly, I’m afraid I don’t really know of any good resources for what you are looking for. Here is one that talks about filters/actions though: https://code.tutsplus.com/articles/the-beginners-guide-to-wordpress-actions-and-filters–wp-27373

    Thread Starter josul

    (@josul)

    Hi, Caleb !

    I already said : the website is is catalog mode, for the moment (perhaps it will change later, that is why I chose woocommerce) ; the user makes selections to list the various colors -most of the products have each several colors- and see the corresponding large images, at the same time (that’s not for no apparent reason since they can’t add to cart with those selections).

    Thank you very much for these explanations and your help !

    Have a good day !
    I put your blog in my favorites

    (I mark as resolved)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘since update woocommerce variations cannot be seen’ is closed to new replies.