• Resolved cosmoweb

    (@cosmoweb)


    Hi,

    I want to cron: woocommerce_cancel_unpaid_orders

    but after some hours i didn’t see that function, I don’t why plugin delete function?

    How can I fix it?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Kuba Mikita

    (@kubitomakita)

    Hi, sorry, I don’t understand your question. Can you elaborate?

    Thread Starter cosmoweb

    (@cosmoweb)

    Hi,

    when I go in Cron Manager and I try to insert new event with this hook (woocommerce_cancel_unpaid_orders) when I return to the list of events, WP or Advanced Cron Manager removes that hook.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Ah I see, so this is most likely WooCommerce removing its schedules. If you need it, just make a proxy.

    Add a cron event with a handle: woocommerce_cancel_unpaid_orders_proxy

    Then in /wp-content/plugins create a file called woo-cron-proxy.php and add inside:

    <?php
    /**
     * Plugin Name: WooCommerce Cron Proxy
     */
    
    add_action( 'woocommerce_cancel_unpaid_orders_proxy', function() {
        do_action_ref_array( 'woocommerce_cancel_unpaid_orders', func_get_args() )
    }, 10, 10 );

    Don’t forget to activate the new plugin!

    That should do the job.

    Thread Starter cosmoweb

    (@cosmoweb)

    Hi,

    thanks for reply, but plugin doesn’t work

    say:

    Parse error: syntax error, unexpected ‘}’

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Ah, sorry, my bad.

    Try this:

    <?php
    /**
     * Plugin Name: WooCommerce Cron Proxy
     */
    
    add_action( 'woocommerce_cancel_unpaid_orders_proxy', function() {
        do_action_ref_array( 'woocommerce_cancel_unpaid_orders', func_get_args() );
    }, 10, 10 );
    Thread Starter cosmoweb

    (@cosmoweb)

    Hi,

    also with this plugin WP remove the hook from the list.

    I also tried to call the file ( woo-cron-proxy.php ) by broswer, and WP say:

    Fatal error: Uncaught Error: Call to undefined function add_action() in /web/htdocs/www…./home/wp-content/plugins/woo-cron-proxy.php:6 Stack trace: #0 {main} thrown in /web/htdocs/www…../home/wp-content/plugins/woo-cron-proxy.php on line 6

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Hi, you cannot access this directly as WordPress isn’t started here.

    But it shouldn’t get removed. You can try to completely change the woocommerce_cancel_unpaid_orders_proxy action to something else.

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