Making custom order actions work with the “Trigger Order Action” action

Note: We are unable to provide support for customizations under our Support Policy. If you need to customize a snippet or extend its functionality, we recommend working with a Woo Agency Partner or finding a WooCommerce developer on Codeable.

WooCommerce order actions can be found in the WooCommerce edit order screen and different plugins, or custom code, can register their own order actions that will appear in the select box.

AutomateWoo includes an action called Trigger Order Action that can run an order action from a workflow.

When creating custom order actions to work with AutomateWoo it’s important to load your code in more than the WordPress admin context. This is because AutomateWoo workflows do not only run in the admin context. There are a couple of solutions available to make a custom order action work with AutomateWoo.

  1. Load the order action code for all requests (e.g. remove any is_admin() conditionals around your code). This works but isn’t very efficient.
  2. The code can be optimized by only loading before the Trigger Order Action action runs (in addition to when you were normally loading it). Be sure to prevent, any logic from running multiple times since multiple actions and workflows can run in the same request. A code example can be found below.
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.