I have some code that generates a WooCommerce order in the backend using wc_create_order(). My issue is that none of the order actions get called like they would if you had made an order through the front end. For example I have the Xero plugin integrated with WooCommerce but if I create the order using wc_create_order() the invoice never gets sent to my Xero account.
What I want to know is how could I trigger the following xero invoice order action (shown in image on woocommerce order) without having to go to the order page and manually send them.
I have possibly found the action I want to call manually it can be found in the setup_hooks() function on this page git hub link. Is it possible for me to call the woocommerce_order_action_xero_manual_invoice action manually if so how?
You will want to call do_action('woocommerce_order_action_xero_manual_invoice', $order)
.
$order
must be an object of class WC_Order
.