REQ Plugin autocompete woocommerce orders

3nails1cross

Active member
Oct 11, 2020
209
93
43
Hold My Beer
Hahaha - It's funny. I've been looking for this kind of plugin just now that can automatically change the Order status from "On hold" to "Completed" when someone trying to complete from the cart to the checkout process.

Been searching in google, but it's not working, free plugins/snippets, but no luck. So I decided to ask ChatGPT. It provides me with a working one hahaha :p

Copy and paste it into your WordPress theme's functions.php file or in a custom plugin...

function auto_complete_orders_on_hold() {
$args = array(
'status' => 'on-hold',
'limit' => -1,
);
$orders = wc_get_orders( $args );
foreach ( $orders as $order ) {
$order->update_status( 'completed' );
}
}
add_action( 'woocommerce_thankyou', 'auto_complete_orders_on_hold' );

Important note:
I've been doing some tests in localhost, not on the live site.
 

KomissarMinsky

Active member
Nov 13, 2018
339
128
43
Hah!
That IS funny, and kind of cool too.

I'm not at all good at adding custom code - where or how should I add this?
Or what should I use to place the code snippet to the site?
ANY guidance you can offer would be greatly appreciated~
 

KomissarMinsky

Active member
Nov 13, 2018
339
128
43
Hah!
That IS funny, and kind of cool too. Oddly any time I try to get on CahtGPT I keep being told its full/has no access.
Let me know if you find this works on a live site, pls sir.
 

3nails1cross

Active member
Oct 11, 2020
209
93
43
Hold My Beer
There are 2-ways to use/implement a snippet/custom snippet in a theme's functions.php file or in a custom plugin. In my case, I just put it in a theme's functions.php, worth noting that every time the theme updates, the custom snippet will be vanished/gone. Just take note of that. Always back up the custom snippet/s if find it useful.

In my case, I just put it in a theme's functions.php. Here's how:

Go to Appearance > Theme File Editor > then choose the right/correct used theme > function.php

Here, (I just put it at the bottom of the code). And I add a separator, something like that to easily locate in case of editing the codes. And paste the code. It works in my case, in offline tests. If it works offline, for sure, it works on live sites too.

Or can edit the file directly from the file manager.

1.PNG
 
  • Like
Reactions: KomissarMinsky

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu