In WooCommerce, you can automatically complete paid orders by using a plugin or custom code.

Using a plugin: There are several plugins available on the WordPress plugin repository that can automatically complete paid orders. Some popular ones include “WooCommerce Auto Complete Order” and “WooCommerce Order Status Manager.” These plugins allow you to set certain conditions, such as payment gateways or order statuses, that will trigger the automatic completion of an order.

Using custom code: You can also use custom code to automatically complete paid orders. One way to do this is to use the woocommerce_payment_complete action hook, which is triggered when a payment is marked as complete.

You can use the following code snippet to add the action to your theme’s functions.php file:

Copy codeadd_action( 'woocommerce_payment_complete', 'wc_auto_complete_paid_orders' );

function wc_auto_complete_paid_orders( $order_id ) {
    $order = wc_get_order( $order_id );
    $order->update_status( 'completed' );

This code will automatically complete all orders that are marked as paid. However, you can customize this function to complete the order only if certain conditions are met, such as the order status being “processing” or the payment gateway being PayPal.

It is important to note that when you use the above code snippet or any plugin, be sure to test it in a development environment before deploying it to a live site, as this could affect your customer’s order process and cause some errors.

Also, be aware that auto-completing orders can change the behavior of other plugins that are using the order status to trigger certain actions, so you should be careful when implementing this functionality and make sure you are aware of how it could affect your store.

(Visited 4 times, 1 visits today)
Was this article helpful?
Close Search Window