Support » Plugin: WooCommerce » woocommerce_cancel_unpaid_orders not working

  • Resolved Elia

    (@prettyboyelias)


    Hi there,

    I have a big problem with the cancel wc_cancel_unpaid_orders() Cron event.

    Almost everyday I have to go to the Inventory page and click “Save changes” because otherwise the Orders won’t be marked as cancelled:
    https://prnt.sc/jcahe9

    Then I see the cron event:
    https://prnt.sc/jcagon

    After some time it just disappears from the list of cron tasks (sometimes immediately after the first run, sometimes after a couple of hours, sometimes after 1 day or so) and I have to go on this screen again and click “Save changes”
    https://prnt.sc/jcahe9

    And this is happening regularly for the last year.

    Could you please help me resolving this issue? How can I make sure that this cron event will run 100% no matter what?

    Please help

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    There’s a few ways to force a CRON job from running, although this will require a bit more knowledge than just regular WordPress.

    For more in-depth articles on this, check out the following:

    Thread Starter Elia

    (@prettyboyelias)

    Hi RK,

    Thanks a lot!

    Do you have an example on how to force running the “woocommerce_cancel_unpaid_orders” ?

    We use server cron

    Plugin Support Hannah S. a11n

    (@fernashes)

    Automattic Happiness Engineer

    Hey there,

    I know it’s possible to force the job to start using Crontroll:
    https://wordpress.org/plugins/wp-crontrol/

    However, troubleshooting cron jobs is something you should take up with your host for further support.

    Thread Starter Elia

    (@prettyboyelias)

    Hi Hannah,

    Many thanks!

    I know it’s possible to force the job to start using Crontroll:

    I tried using the Crontrol.

    The screenshots that I took in the 1 message are from this tool.

    When I add the task woocommerce_cancel_unpaid_orders it works also but disappears after some time. Even though I set to repeat it 🙁

    However, troubleshooting cron jobs is something you should take up with your host for further support.

    I actually spoke to Plesk (my host) before creating the ticket. They said the following:

    ” That will be only possible if this WooCommrce task can be run as a .php script. Plesk allows to run .php scripts using cron functionality, so what you need:

    1. Find out how to run that task as a .php script, it may looks like:
    /usr/bin/php /var/www/vhosts/example.com/httpdocs/woocommerce/clear_orders.php

    If that possible and how to do that properly, better to clarify with WooCommerce support or using their community.

    2. Create such a task in Plesk using Task Scheduler:
    https://docs.plesk.com/en-US/onyx/administrator-guide/server-administration/scheduling-tasks.64993/

    —–
    I don’t understand how to use their advice

    Plugin Support Hannah S. a11n

    (@fernashes)

    Automattic Happiness Engineer

    Plesk is suggesting you use their interface to run the cron jobs via a task scheduler, rather than via a plugin. Really, you shouldn’t need to do this – something on the server is stopping the cron jobs from running correctly in the first place.

    I can’t do much more to help you here, as this is something that happens at server level. The best I can do is point you in the right direction, which is that something is going wrong with the timer jobs and that’s a server issue.

    celticwebdesign

    (@celticwebdesign)

    Hi Hannah,

    I am also experiencing that same issue with a website using Woocommerce.
    An order is placed but not paid and sometimes the cron appears to run (changing payment processing to cancelled) and other times not (remains payment processing beyond the 60 minute hold time).

    I did like prettyboyelias said above and re-save the Woocommerce settings hold time and can see the cron is setup to run, but I assume this cron should also be set every time a new order is started (before going to a payment provider)?
    If this is correct, where is this cron set each time, and if it is not set why would this be?

    Thanks

    cosmoweb

    (@cosmoweb)

    Hi,

    any solution about this problem?

    Thanks

    • This reply was modified 3 years ago by cosmoweb.
    celticwebdesign

    (@celticwebdesign)

    Hi,

    I have now found the issue and resolved it.

    It was related to the hosting of the website, WPEngine.
    They provide a caching system built into their hosting, in this case the caching system was caching the wc-order-functions.php file, this therefore was preventing the cron from being setup.
    WPEngine uncached this file and the cron has now been setup and continuously running every 60 minutes.

    I hope this helps.

    Thanks
    Darren

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘woocommerce_cancel_unpaid_orders not working’ is closed to new replies.