• Resolved nicole0155

    (@nicole0155)


    We are not using related products standard feature. However, during the daily updates (more than 10000 products a day with APIs) the hook wc_delete_related_product_transients_async its running without any need.

    As a result we have a huge number of Scheduled Actions, delays on processes and higher server load.

    To temporary solve this issue we have comment the following lines on

    /wp-content/plugins/woocommerce/includes/wp-product-functions.php:

    // WC()->queue()->schedule_single(
    // time(),
    // 'wc_delete_related_product_transients_async',
    // array( 'post_id' => $post_id ),
    // 'wc_delete_related_product_transients_group'
    // );

    We would like to now if its possible to disable this feature at admin panel or any alternative way, without changing the souce code. We have tested several personalized mu-plugins without effect.

    Many thanks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Same problem 700k wc_delete_related_product_transients_async actions in pending. and not only us I am seeing several posts about this from yesterday. I think it’s for updating wordpress 6.8 or updating WooCommerce.

    • This reply was modified 1 year, 2 months ago by Bulbul Islam.

    Hi @nicole0155,

    I completely understand how frustrating it must be to deal with high server load and a backlog of scheduled actions, especially when you’re managing daily updates for a large product catalog.

    Currently, there isn’t a built-in setting in the WooCommerce admin panel to disable the wc_delete_related_product_transients_async hook. Editing the plugin files, as you’ve done temporarily, is not recommended long-term since those changes would be overwritten on the next plugin update.

    A more stable solution would be to unhook the action safely through a custom code snippet added via a small custom plugin or your theme’s functions.php file. Here’s an example you can try:

    add_action( 'init', function() {
        remove_action( 'save_post_product', 'woocommerce_delete_product_transients', 10 );
    });

    This code will remove the scheduled transient deletion when a product is updated or saved, preventing wc_delete_related_product_transients_async from being triggered unnecessarily.

    If you continue to see an unusually high number of scheduled actions even after this, please let us know, and we can explore further optimization steps with you.

    Thread Starter nicole0155

    (@nicole0155)

    Hi @lovingbro

    Thanks for your reply.

    We have tested the code

    add_action( 'init', function() {
    remove_action( 'save_post_product', 'woocommerce_delete_product_transients', 10 );
    });

    as well as many variants similar to such one, with more hooks than save_post_product, and several priorities. As example, we have tested a mu-plugin with the following code (and also a few variants):

    add_action( 'woocommerce_update_product', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_new_product', 'custom_prevent_related_product_transient', 0 );
    add_action( 'save_post_product', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_product_set_visibility', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_product_set_stock_status', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_product_set_stock', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_product_set_status', 'custom_prevent_related_product_transient', 0 );
    add_action( 'save_post', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_update_order', 'custom_prevent_related_product_transient', 0 );
    add_action( 'woocommerce_product_bulk_edit_save', 'custom_prevent_related_product_transient', 0 );

    function custom_prevent_related_product_transient() {
    remove_action( 'woocommerce_product_set_visibility', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_product_set_stock', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_product_set_price', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_product_set_sale_price', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_update_product', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_new_product', 'wc_delete_related_product_transients_async' );
    remove_action( 'save_post_product', 'wc_delete_related_product_transients_async' );
    remove_action( 'wp_insert_post', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_product_set_stock_status', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_product_set_status', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_update_order', 'wc_delete_related_product_transients_async' );
    remove_action( 'woocommerce_product_bulk_edit_save', 'wc_delete_related_product_transients_async' );
    // error_log( 'done' );
    }

    In any case we had no success.

    Unless you have a different suggestion we will keep the code changed until there is a built-in setting in the WooCommerce admin panel to disable the wc_delete_related_product_transients_async hook.

    Thank you

    Hi @nicole0155,

    Thank you for reaching out. I’d like us to take a step back for better clarity.

    You mentioned earlier that you’re not using WooCommerce’s default related products feature. Just to confirm, does this mean you have a related products section that was manually added? If so, could you please share a link to your site?

    Additionally, please share your system status report. You can upload it to a platform like Pastebin and provide the link here.

    Lastly, kindly explain how the related products feature was added if it wasn’t set up using WooCommerce’s default functionality.

    Thread Starter nicole0155

    (@nicole0155)

    Dear @mosesmedh

    We have a related products section that was manually added, replacing the related.php at flatsome theme. Such section never calls woocommerce_related_products(); since we are only using internal categories to select some related products. It not causing the events wc_delete_related_product_transients_async.

    We undertand the wc_delete_related_product_transients_async hook is triggered only when WooCommerce saves or updates related product relationships, such as when a product is saved and WooCommerce generates or caches related product data.

    Thats why we would like to avoide having such wc_delete_related_product_transients_async hook tasks, disabling it.

    I am running into the same issue on multiple WooCommerce sites. The action scheduler table is filled with million of rows with the wc_delete_related_product_transients_async events.

    When downgrading WooCommerce to version 9.7.1 omits the issue.

    • This reply was modified 1 year, 2 months ago by kipzes.

    Hi there,

    If you’re still experiencing this issue, please make sure you’re using the latest WooCommerce version — 9.8.3. That update includes a fix for this:

    Fix – Add static cache and queue search to prevent duplicate scheduling of the wc_delete_related_product_transients_async action in wc_delete_product_transients(). #57592

    Updating should resolve the issue, but feel free to reply here if it continues — we’re here to help.

    Thread Starter nicole0155

    (@nicole0155)

    Yes, using the latest WooCommerce version — 9.8.3 the situation seems improved.

    Thank you!

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    I’m glad the latest WooCommerce update (9.8.3) has improved the situation for you!

    If you have a moment, we’d really appreciate it if you could leave a review for WooCommerce. Your feedback helps us continue improving and also supports other users in the community.

    You can leave a review here: https://wordpress.org/support/plugin/woocommerce/reviews/

    Thanks again for your time and support!

    mananmushtaq02

    (@mananmushtaq02)

    Hi There,

    We are using woo version 9.9.5 but we are facing this issue. We see many pending wc_delete_related_product_transients_async actions, these start a specific time and end at specific time. Is there any way to stop this and what is the use of this, as thing was not an issue in previous version of woo

    Hi @mananmushtaq02

    I understand that you have a somewhat similar problem.

    However, per forum best practices and guidelines, it is advised that you create a new topic so that we can address your issue(s) separately: https://wordpress.org/support/forum-user-guide/faq/#:~:text=get%20individual%20help.-,I%20have%20the%20same%20problem,-!%20Can%20I%20just.

    You can create a new thread here: https://wordpress.org/support/plugin/woocommerce/#new-topic-0 and make sure to include as much information as you can.

    Thanks for understanding!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Disable hook wc_delete_related_product_transients_async’ is closed to new replies.