Automatically Complete WooCommerce Orders

Sharing is caring!

When a WooCommerce order is placed, the customer will pay for it, the order will be fulfilled and the item(s) dispatched, at which point the order will probably be marked as ‘Completed’.

This process is supported in WooCommerce and allows the order to go from ‘Pending’, to ‘Processing’, and finally to ‘Completed’ once the products have been sent out.

This is fine for orders where a physical item exists, but this seems not correct with virtual orders becuase there is no notion of postage or sending out items.

In this case, when someone paid via PayPal we needed to set the order straight to ‘Completed’ once payment had been received, instead of having to manually log into WordPress and update the order status ourselves.

The steps below explain how to achieved this, as well as how We overcame some problems along the way where We got stuck.

[sam id=”5″ codes=”true”]

  1. Option 1
    Sometimes merchants want orders to be marked “complete” automatically – without any manual intervention.WooCommerce can automatically mark orders as complete if they only contain downloadable products.
    But if your order contains only virtual products, it leaves order status as “processing” after the payment is received.In a lot of situation, this is not the desired behavior. You’d need to manually mark each order as completed – and that’s too time consuming. Auto Complete all WooCommerce orders, add this code to theme’s functions.php file.
    <code>

    /**
    * Auto Complete all WooCommerce orders.
    * Add to theme functions.php file
    */
     
    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
    function custom_woocommerce_auto_complete_order( $order_id ) {
        global $woocommerce;
     
        if ( !$order_id )
            return;
        $order = new WC_Order( $order_id );
        $order->update_status( 'completed' );
    }

    </code>
    Please note: The code  is considered as custom coding and we are unable provide support for customizations. If you do need assistance, we recommend contacting one of our Affiliated WooWorkers.

  2. Option 21. Download and activate the ‘WooCommerce Autocomplete Order’ plugin.
    2. Set Your Products as ‘VIRTUAL’
    This plugin only works for orders containing virtual products so make sure you’ve ticked the ‘Virtual’ box on your products.woocommerce-virtual3. Activate PayPal IPN
    PayPal Instant Payment Notification (IPN) is a message service that automatically notifies merchants (Your WooCommerce Store) of events related to PayPal transactions.To setup IPN you need to login to PayPal itself, navigate to ‘Profile > My Selling Tools > Instant payment notifications’ and update the information as follows:paypal-ipn

    Simply enter the URL in the format ‘http://your-website .com/?wc-api=WC_Gateway_Paypal‘, enable IPN messages and click ‘Save’.

    4. Please Make Sure that ‘RECEIVER EMAIL’ Is Correct
    The last remaining step is to ensure the ‘Receiver Email’ setting in WooCommerce under the ‘PayPal’ section is set correctly. Normally I believe you should be able to leave this blank, however if you’ve changed it for testing or debugging purposes, it might be worth just making sure that this is correct. The final step is to simply carry out an order and hopefully, as soon as the payment has been made via PayPal, the order will automatically be set to ‘Completed’ in the WooCommerce back-end. No more having to login and set it manually.

    Note: Another option for same issue can be get from WooCommerce Offical website  WooCommerce Order Status Control

One thought on “Automatically Complete WooCommerce Orders

Leave a Reply

Your email address will not be published. Required fields are marked *

Got Project on mind? Let's ConnectContact Us

Secured By miniOrange