Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Set Completed WooCommerce Order Status to On-Hold?

When you sell virtual and downloadable products in WooCommerce, they’re automatically marked as ‘Completed’ once bought. But what if you want to wait before finalizing them? Maybe you need to double-check something or give it a personal touch. Well, good news! With a simple code change, you can put these orders ‘On Hold’ until you’re ready to complete them.

Solution: Set Completed WooCommerce Order Status to On-Hold

The code snippet will help you to automatically change the status of an order to “on-hold” immediately after it’s marked as “completed”.

add_action('woocommerce_order_status_completed', 'ts_completed_to_onhold');

function ts_completed_to_onhold($order_id) {

    $order = new WC_Order($order_id);
    $order->update_status('on-hold');
}

Output

After a successful payment process, orders typically move to the ‘Completed’ status. However, this code snippet alters the default order fulfillment process, setting it to the ‘On Hold’ status instead.

How to Set Completed WooCommerce Order Status to On-Hold? - Tyche Softwares

While the code shared in this post applies to all products, do you want to customize it specifically for downloadable products? Don’t worry! We have covered the solution in our post on how to change order status for downloadable products in WooCommerce.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x