Introducing Trigger Happy

Customize WordPress without writing code

Matthew Zalewski
Hotsource.io
4 min readNov 5, 2017

--

A few months back I wrote an article about WordPress Code Snippets — at the time, it was simply meant to be an online reference for common snippets of code that I use fairly regularly.

It ended up getting quite a few views, so this prompted me to finally finish a plugin that I had been working on.

Trigger Happy

As a WordPress plugin developer, clients often ask me to create a plugin that implements fairly simple functionality. Add Feature X to Page Y, or integrate plugin A with plugin B.

There are thousands of plugins available for WordPress — but unfortunately, they aren’t always designed to work well together.

Looking to add a Ninja Forms contact form to out of stock items on WooCommerce? Or maybe you want to add a discount based on the user’s membership level? After hours of searching for a suitable plugin, you’ll likely come up with nothing — and realise you need to code it yourself.

But what if you can’t write code?

That’s where Trigger Happy comes in.

Triggers and Actions

To put it simply, Trigger Happy allows you to create triggers that run actions. In the first example above, the trigger could be “When viewing WooCommerce product that is out of stock”, and the action would be “Display a Ninja Form”.

Let’s go over the steps required to add this using Trigger Happy

  1. Add the trigger
    When we first add a new “Flow”, we’ll be asked to select a trigger.
    This is easy enough to do. Simply click on the WooCommerce icon to filter down to WooCommerce-specific triggers, then select the one named “When Viewing Single Product Page
Selecting a trigger

2. Next we’ll be able to set options for this trigger. In this particular trigger, we’re able to specify where we want to inject the new content — we’ll pick “Before the product meta data” which is displayed just under the Add to Cart button.

Edit Trigger Settings

3. After clicking Next, we’ll then be able to select the Action we want to perform. In this case, we want to render a Ninja Form, so we select “Ninja Forms” to filter the available actions then click “Display Form”.

Select an Action

4. We’ll also need to configure the action by selecting the form we want to display

Configure the action

5. Finally, we want to ensure the form is only displayed on Products that are out of stock. To do this, we use the Filters section at the bottom of the page.

Simply add a new filter, select the Product -> In Stock option and set the value to “No”

Add the filters

And that’s it. Give your Flow a name and click “Publish” to set it live.

The End Result

Now when you navigate to a product that is out of stock, you’ll be able to see your form displayed underneath the Product Summary section.

This is just one example of what you can do with Trigger Happy. Support for additional plugins and functionality is being added every day. And even if your favourite plugin isn’t supported, you can still use the “Custom Hook” trigger to hook into it.

We currently have built-in support for WordPress Core, WooCommerce, Ninja Forms and ACF.

Calculations

Each trigger or action will expose different data depending on the context. For example, the “Calculate Fees at Checkout” trigger will allow you to access data from the users cart — while Modify Post Content will give you access to the post data.

This data can be used to create powerful calculations as shown in the following screenshot (which adds a 50% surcharge to orders at checkout).

What’s next?

The plan is to get the popular plugins supported initially and then start adding support for smaller plugins.

I also plan to add a “Flow-to-code” function that will output selected Flows as a standalone plugin — allowing you to create entire plugins without writing a single line of code.

Longer term, I want to add community-created triggers and actions. This will help increase the number of plugins that Trigger Happy supports by allowing developers and other users to design Triggers, Actions and Data using a drag and drop interface.

Official Page

You can check out the plugin here: http://hotsource.io/

I’ll continue to post regular weekly updates detailing changes and progress, so consider signing up to the newsletter below.

--

--