Order status no longer changing when adding shipment tracking number
-
I’m using the Woocommerce Shipment tracking plugin to enter tracking numbers to orders. We added a custom code snippet, to automatically mark the order as completed when the tracking number is added.
Since a few weeks, probably early september, this is no longer working as it should: the order is not getting marked ‘completed’ when adding the number, but when we remove the tracking number, it does change to completed.I know this is the woocommerce support, but I tested with an earlier version of the Shipment tracking plugin (1.6.8) and the problem is the same, which leads me to believe something has changed in woocommerce that makes that the code snippet no longer works.
This is the code snippetfunction update_order_status_when_shipment_tracking_input( $meta_id, $object_id, $meta_key, $meta_value ){ if( $meta_key == '_wc_shipment_tracking_items' ){ error_log('update_order_status_when_shipment_tracking_input'); $order = wc_get_order( $object_id ); if( $order ){ $order->update_status( 'completed' ); } } } add_action( 'update_postmeta', 'update_order_status_when_shipment_tracking_input', 10, 4 );
Has something chnaged in the way that woocommerce updates the order status?
Or can someone tell me how I should update this snippet to make it work again?
- The topic ‘Order status no longer changing when adding shipment tracking number’ is closed to new replies.