1. Documentation /
  2. AutomateWoo /
  3. Actions /
  4. Making custom order actions work with the "Trigger Order Action" action

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

Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.

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.

WooCommerce

The most customizable eCommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment