Thomas Bolander
Thomas Bolander

Reputation: 3952

Wordpress with WooCommerce add_actions not working

I'm trying to add a function (hook) after payment is completed in Wordpress where i use the plugin woocomerce.

The documentation for woocommere says that there is an action called "woocommerce_payment_complete" and a filter called "woocommerce_payment_complete_order_status"

Nothing is happend, when i try to use them

add_action('woocommerce_payment_complete', 'do_something_foo');

function do_something_foo() {
    wp_die("foo!");

}

Why doesn't it work ?

Thanks !

Upvotes: 3

Views: 1143

Answers (1)

Nick Klufas
Nick Klufas

Reputation: 218

In my experience around woocommerce I've always had much more success hooking the order status action, perhaps this is a viable alternative for your solution?

add_action( 'woocommerce_order_status_completed', 'do_something_foo' );

   function do_something_foo() {
   wp_die("foo!");

}

Upvotes: 1

Related Questions