Get All Order Data and post it to custom table
-
I would like to register an action on
woocommerce_order_status_completed
i.e. when the order status is completed, to get all the order data with the$order_id
and post it to a custom table.What i need, do we have an order object or similar available may be an array which can give me all the relevant information like
For example
customer email
ordered item
ordered item quantity
order payment statusI’m unsure how to retrive all these information in my action function.
Once I have these values available i can easily assign them to different variables and post them into a table.Here is how i defined my action in my simple plugin file
/** * Check if WooCommerce is active **/ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { // Put your plugin code here function order_export_to_app($order_id) { } add_action( 'woocommerce_order_status_completed', 'order_export_to_app'); }
- The topic ‘Get All Order Data and post it to custom table’ is closed to new replies.