Tuesday, 3 September 2013

Woocommerce add a function to modify user field when order completed

Woocommerce add a function to modify user field when order completed

I'm figuring out whit this scenario:
1.- I've got Woocommerce 2.0. 2.- Need to add a function which is
triggered when the order is completed. 3.- Then this function must to now
the product and modify an user in the databse.
I'm new at PHP. So, what i'm making is something like:
add_action('woocommerce_order_status_completed_notification','my_function')
Ok... But my question:
1.- In which file must implement this add_action ant my_function? 2.- How
can I access to the order details, like order_id,products,user...??
I was taking a look to the woocommerce classes, and I need a
WC_Order($id_product).... But i'm frustrating now :(
Can anyone help me, please? Thank you

No comments:

Post a Comment