Reputation: 65
I am using woocommerce twilio extension which allow me to trigger sms based on order status changes in woocommerce. I have added 2 new customized order status - namely Shipping and Delivered. I would like to know what action hook that I can used to hook, to auto send out sms in Twilio.
// Customer order status change hooks
foreach( array( 'pending', 'failed', 'on-hold', 'processing', 'completed', 'refunded', 'cancelled' ) as $status ) {
add_action( 'woocommerce_order_status_' . $status, array( $this, 'send_customer_notification' ) );
}
Looking at the script of extension, it seems to me I am not able to do that because there is no woocommerce_order_statsus_shipping or woocommerce_order_statsus_delivered that I can hook to.
Any way to work around this limitation?
Upvotes: 0
Views: 1046
Reputation: 3125
While I haven't worked with woocommerce specifically, I have done a lot with WP hooks in general. It looks like there are two different ways to catch this one:
woocommerce_order_status_.$new_status->slug
which looks like it gets fired when the order shifts into a particular status and
woocommerce_order_status_.$this->status._to_.$new_status->slug
which looks like it catches things moving from one specific status and into another specific status. Does that help?
Source: http://docs.woothemes.com/document/hooks/
Upvotes: 1