Site icon Qaisar Satti's Blogs

WooCommerce Auto Complete Orders

Today, I have consumed this space to convey how you can change WooCommerce Auto Complete Paid Orders programmatically. The program-based functionality is quite simple. There are seven default statuses available that can be used as per your requirements. So, let me explain with the help of an example:

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

Here is example of auto complete paid orders.

$orderId = 10;
$orderDetail = new WC_Order( $orderId );
if($orderDetail->get_status()=='processing') {
$orderDetail->update_status("wc-completed", 'Completed', TRUE);
}
Exit mobile version