WooCommerce change order status programmatically

WooCommerce change order status programmatically

Today we talk about how to change WooCommerce order status programmatically. Sometimes you need to change order status programmatically. There is seven default status the are available that you can use as per your requirements. So let start with our example.

$orderId = 10;
$orderDetail = new WC_Order( $order_id );
$orderDetail->update_status("wc-completed", 'Completed', TRUE);

The following are the list of available status

wc-pending   For Pending payment
wc-processing   For Processing
wc-on-hold   For On hold
wc-completed   For Completed
wc-cancelled   For Cancelled
wc-refunded   For Refunded
wc-failed   For Failed

Search

Recent Blogs

Categories

Archives

Archives

Tags