Ever wanted your WooCommerce orders to be marked as “complete” straight away – for example if you never need them to be marked “processing” (maybe they are downloads, or a membership, or some other reason which means “processing” is not helpful to you, for example!?)?
The snippet below in this page will get you there. Its designed to make sure a WooCommerce order goes straight to Complete on the customer reaching the thank-you page – i.e. when their payment has successfully completed in WooCommerce.
Remember you can disable processing mail, too
Please note, it is still worth visiting WooCommerce > Settings > Emails and disabling the “Processing” email, as this may still be triggered, resulting in a double mail. If you’re not using the “processing” status, then turning off the mail is a good idea, as you simply don’t need it ever to fire.
The code snippet
The code snippet below should be placed into your child theme’s functions.php file, placed into a snippets plugin, or a custom plugin:
Let us know if this works for you!
Leave a comment below if this worked for you – or if you encountered any issues making this work – and help the Open Source community to learn from each other’s experiences, too.
Is there a way of doing this except for BACS paid orders, so for example PayPal and Stripe orders go straight to Completed but not BACS?
Hi Jay – yes, it would be possible to do this selectively based on payment gateway. Its probably best to ask a developer to make a custom function based on this. You can find great WordPress and WooCommerce developers on Codeable (we have a form here which would allow you to post a task there: https://silicondales.com/post-a-task-to-codeable/ ) – if you use this form, you could link to this post URL (https://silicondales.com/tutorials/woocommerce/automatically-mark-woocommerce-orders-complete-receipt-payment/ ) and say “I’d like to use this function, but only if payment gateway other than bank transfer is used” – a developer will know how to build you this.
Hello Robin,
There is an issue with the idea.
Some payment gateways use woocommerce_thankyou hook to throw up “Payment Failed” messages.
Thus, there is a risk of orders being marked as “Completed” even when the payment has failed. This has happened to some of the orders on my store.
Do you have a solution to the issue?
Thanks,
Manju
Hi Manju,
The short answer is, that is not where plugins should be loading “payment failed” messages- so try not to use gateways which do this, or write a new gateway plugin which uses the payment API correctly (throw an error and return “null”)
https://docs.woocommerce.com/document/payment-gateway-api/
What you are describing is “doing it wrong” – there’s no getting around that.
thank you so much the code is working fine for me 🙂