WooCommerce is the most popular WordPress e-commerce plugin in the world, powering more than 30% of all online stores. Join our YouTube channel learn everything you need to know about WooCommerce, WordPress, and e-commerce. Being an open source and more advanced creative programmers, you get there are many features that are requested by our client or you find you need most.
Learn how to add WooCommerce autocomplete order using code snippet. The status will change from pending to complete automatically once the payment is done.
Attached is a WooCommerce autocomplete orders status YouTube tutorial
Tutorial will be available soon
Copy and paste the code to add the feature to your ecommerce website.
/**
* Auto Complete all WooCommerce orders.
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order');
function custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
$order->update_status( 'completed' );
}
Use code snippet free plugin from wordpress.org plugin repository.
We are going to add these features that allows WooCommerce to autocomplete the order all for free. the code will help from changing the order from pending to complete. However, there are some limitation that this code will work; the code will work only when using online payment e.g. “PayPal”, “credit card” etc. the limit will come when you have for “BACS”, “Pay on delivery” and “Cheque” payment methods.
You may also like: How to hide prices until user login in WooCommerce with PHP code
[…] You many also like to read: WooCommerce Order Status ( Autocomplete paid WooCommerce orders) […]