I am developing woocommerce extension wher i need to perform some task after order is successfully completed. For that I started coding.
I used following code in constructor of my class.
add_action(âwoocommerce_order_status_completedâ,array(&$this,âinsert_pointsâ));
Then I defined function as follows:
public function insert_points($order_id)
{
global $woocommerce, $table_prefix;
$order = new WC_Order($order_id);
var_dump($order);
}
But it is not working.
Can anybody please help me using code sample.
May be try this
add_action hooks has last argument which specifies how many arguments to pass to function in hook.