• vaschops

    (@vaschops)


    PART A

    I have created a woocommerce website using crocoblock plugins ..and so far everything was running ok. Lately though appeared a very persistent issue with the stock. Some products appear as out of stock in the front end ..although when editing those products, they do have stock available ..and if updating the product (without changing something), the front end also shows correctly that it is in stock. The persisting issue is that even than I bulk updated all products (twice till now) after a few days the issue starts appearing randomly again.

    “This product is currently out of stock and unavailable.”

    This is the message shown by products that have the problem ..although they have stock available, and a simple update of the product solves the issue temporarily. Tried a few things ..disabled cache, disabled plugins to check for conflicts, reverted to a default theme, optimized the database, converted all tables to InnoDB, removed transients… Nothing seems to do the job – the problem is still there.

    PART B

    a key point is that a product that works ok, loads the variations as seen here: https://gyazo.com/0b29ddf234f0ab794176d9672d95d399

    whereas a product with the stock issue, does not load the variations: https://gyazo.com/14512f7e44c1083b7a937824c1275d8c

    A simple change in the product variations > Save changes ..or by simply updating the product (edit product page) ..corrects the issue. But after some days ..randomly, other products start behaving like this again.

    PART C

    I migrated the site to a new server ..but unfortunately the issue persists. There is another clone on another host/server, litespeed, with less resources (so it loads very slow) ..BUT after the migration it sort of crashed and repaired itself (it looked like that) ..and then the problem disappeared! And still haven’t reappeared to my knowledge. Will have to thoroughly check again if this is the case indeed.

    So at the moment, I have a freshly migrated site ..a staging site on the same server (both with the stock issue) ..and a third copy of the site on another host/server. It should plenty to help with the troubleshooting.

    From what I see in other threads here and in github ..this is a persisting issue that has not been resolved for some time now.

    Please advise
    Kind thanks

Viewing 2 replies - 16 through 17 (of 17 total)
  • Plugin Support Jonayed Hosen (woo-hc)

    (@jonayedhosen)

    Hi @vaschops,

    It looks like you’ve encountered a known issue related to WooCommerce transients, as several users have reported similar problems. Specifically, this appears to involve transient cache entries, such as wc_var_prices_ and wc_product_children_, which can sometimes cause issues with product data.

    While our developers investigate a potential fix, could you please try this workaround to see if it resolves the issue? You can add the following code snippet to your site, either through a code snippets plugin or directly in the functions.php file of your theme:

    add_action( 'setted_transient', 'delete_wc_specific_transients_after_set', 10, 2 );
    add_action( 'setted_site_transient', 'delete_wc_specific_transients_after_set', 10, 2 );

    function delete_wc_specific_transients_after_set( $transient, $value ) {
    if ( strpos( $transient, 'wc_var_prices_' ) === 0 || strpos( $transient, 'wc_product_children_' ) === 0 ) {
    delete_transient( $transient );
    }
    }

    If this workaround resolves the issue, please let us know! You can also keep an eye on developer updates regarding this github issue, and if they confirm it’s a bug, they’ll work on a permanent fix.

    Thank you for your patience, and feel free to reach out with any further questions!

    Thread Starter vaschops

    (@vaschops)

    UPDATE

    Overall this solution seems to pinpoint and fix the issue ..almost.

    I added the snippet to the live website ..and for the last week it seems to run ok ..for the default language.

    But today we noticed that on another language (3 in total set with TranslatePress) the notorious message came back – or never left.

    Does the fix you provide tackle transients in every language?

    I am not sure how translations are recorded in the database ..or their transients ..but if you are working on a proper fix, you have to take translations into account too.

Viewing 2 replies - 16 through 17 (of 17 total)
  • You must be logged in to reply to this topic.