• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Essential Premium WooCommerce Plugins - WP Desk
  • Plugins
  • Bundle
  • Support
  • Blog
  • My Account
  • 0

Stay updated on our how-to articles

WP Desk news, WooCommerce tips, promo codes - right to your inbox.

By entering your e-mail, you agree to our Terms & Conditions and Privacy Policy.

Piotr Ostrowski

Change WooCommerce order status using woocommerce_payment_complete hook

Updated: January 03, 2023 / Plugin Tutorials

By default, clean WooCommerce installation will change order status to Processing after successful payment. This is very useful for physical orders. Thanks to this behavior, the customers know the shop staff is working on the order. As the customer sees that the order is paid and being processed, he knows the staff is preparing the shipment packing the products. You can extend this scenario for all orders by using woocommerce_payment_complete hook or a plugin. Learn how to change order status after payment to Completed:

All of the solutions presented below will work with any payment gateway (standard, built-in or custom, added using a plugin).

Default WooCommerce behavior

The only exception is when the items in the cart are Downloadable. If so, the order status will always change to Completed after successful payment.

Change the WooCommerce order status to completed after successful payment for orders with all downloadable items
WooCommerce products should set as Downloadable & Virtual to automatically set the status to Completed after payment

This is also very convenient. In most cases, the store staff does not need to take any extra actions when the customer buys downloadable products. So it is a good idea to automatically change the order status to Completed.

How WooCommerce changes the order status after the successful payment for orders with downloadable and physical products
WooCommerce will change the order status to Processing or Completed after payment, depending on the cart itmes

Change WooCommerce order status to Completed after payment using a filter - woocommerce_payment_complete

After the successful payment, the woocommerce_payment_complete hook is fired. Weel, so you can use it to programmatically change every order’s status to Completed after payment.

Please add this PHP snippet to your WordPress / WooCommerce site:

How to add this PHP code to your WooCommerce site

You can simply edit functions.php file of your theme and add the filter containing woocommerce_payment_complete hook. But please beware that you will lost the changes if you update your theme to the latest version.

One of the recommended solutions is to use a custom plugin and insert the code inside the plugin file. Using the custom plugin for adding the code you can be sure that changes won’t be lost and you will have full control over the code and will be able to turn it on / off.

Change WooCommerce order status to Completed after payment using a plugin

There is this small, but very powerful WooCommerce plugin called Automatic Payment Status. It allows you to automatically change order statuses to Completed once you receive the payment.

WooCommerce auto complete orders plugin to automatically complete orders in an online store

The settings allow choosing which orders justify automatic changes in the status:

  • no changes - the plugin won’t interfere with standard WooCommerce behavior
  • for orders with at least one virtual product - plugin will check the contents of every order and change its status to Completed after payment only if there is at least one virtual product in the cart
  • for orders with virtual products only - if there’s at least one physical item in the order, the standard WooCommerce behavior won’t be changed. If there are only virtual products, the order status will be changed to Completed after the payment.
  • for all orders - all orders’ statuses will be changed to Completed after successful payment

Here's a quick video that will guide through the plugin settings:

This plugin is available at WP Desk store:

Automatic Payment Status WooCommerce £29

Autocomplete WooCommerce orders after successful payment. Choose between virtual, partly virtual or all orders.

Add to cart or View Details
WP Desk
Plugins used by 235,543+ shops
Last Updated: 2023-03-02
Works with WooCommerce 7.1 - 7.5.x

Use a woocommerce_order_status_completed filter to execute an action after completing WooCommerce order

The woocommerce_order_status_completed hook is fired after setting the order status to Completed. So it will work perfectly with the Automatic Payment Status plugin! Use this hook to execute some action after completing WooCommerce order. You can use the example below:

As you see from the code, your customers user role will be changed to VIP Member once the order is completed:

woocommerce_order_status_completed hook example to automatically change WooCommerce order status programmatically based on user roles

Summary

Well, so from my WooCommerce guide, you have learned how to use both woocommerce_payment_complete and woocommerce_order_status_completed. I hope you can use my examples for creating your own automations in your shop.

Please remember that you can also use a quick and simple Automatic Payment Status plugin to change the order status to Completed after payment.

In this article, you've learned a few things about:

  • woocommerce_payment_complete hook
  • woocommerce_order_status_completed hook
  • woocommerce change order status programmatically

If you have any further questions, leave a comment below or contact us.

Tweet

3 minutes read11034 views

Piotr Ostrowski

He loves space exploration, pinball and smart internet solutions. He loves WordPress, and WordPress loves him back.

Powered by WP Desk

WP Desk brings you great WooCommerce plugins. We strive to save your time and money by speeding up your processes. Use our plugins to build a better store. Awesome support included in the package.

Premium WooCommerce Plugins →

Stay updated on our how-to articles

WP Desk news, WooCommerce tips, promo codes - right to your inbox.

By entering your e-mail, you agree to our Terms & Conditions and Privacy Policy.

WP Desk › Plugin Tutorials › Change WooCommerce order status using woocommerce_payment_complete hook

Footer

WP Desk - WooCommerce Plugins

At WP Desk we create great WooCommerce plugins with awesome support. Save time and money with our e-commerce solutions. See how we can help you improve your e-store →

Secured by Comodo

WP Desk

  • About us
  • Giving Back
  • Blog
  • Contact us

Products

  • Premium Plugins
  • Get Support
  • WooCommerce Invoices
  • Email Marketing
  • Octolize

Legal

  • Terms & Conditions
  • Refund Policy
  • Support Policy
  • Privacy Policy

© 2023 WP Desk