• Resolved stevokel

    (@stevokel)


    Hello everyone,

    I have a custom on_order_completed function that I run before the plugin’s on_order_completed and therefore all works fine, but I want to remove_action the original on_order_completed. How can I do that?

    I tried from functions.php with:
    remove_action( ‘woocommerce_order_status_completed’, array($mangopayWCMain , ‘on_order_completed’ ), 15, 1 );

    which is literally what the add_action filter is (found mangopayWCHooks::set_hooks). It doesn’t work due to the undefined $mangopayWCMain variable, but I cannot figure how to.

    I will be happy for any clues! Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Yann at WP&Co

    (@ydubois)

    Hi @stevokel

    If you do remove this action hook, the MANGOPAY payment will not work out because the wallet transfers of the fund will never happen, so this is not recommended and unsupported.

    This might work if you absolutely need to remove the hook:

    global $mngpp_o;
    remove_action( ‘woocommerce_order_status_completed’, array($mngpp_o , ‘on_order_completed’ ), 15, 1 );

    Use at your own risks…

    Thread Starter stevokel

    (@stevokel)

    Thank you, Yann!

    I will try it out, but from what I see, it will work ??

    As I mentioned, I have the same function with a few extra clauses, so everything works fine and this function is just being constantly run for nothing, so I want it removed.

    Thank you again for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove_action on_order_completed’ is closed to new replies.