Rules - aareano/ifshop-wiki GitHub Wiki

ifshop was so named because it gets at the heart of what the tool does: if-this-then-that automation.

The automation is encapsulated in a rule. A rule comprises an event and a sequence of zero or more actions. The event triggers the rule, which then executes the actions.

Creating a rule

To create a rule, use the event selection and New Rule button located at the top of the Rules page (accessible via the navigation drawer). Your new rule will be displayed along with the rest of the rules, which you can click on to edit.

Anatomy a rule, and how to edit

Clicking on the rule you'd like to edit will bring you to the edit page for that rule.

Important: any and all changes you make to the rule will be saved automatically. There's no "save" button - just glance up in the top right corner to see that your changes have been saved.

Title

The rule's title is an identifier used to distinguish one rule from another at a glance. It also appears in the activity log on the dashboard to identify which rule a action belongs to.

Edit the title using the uppermost text field on the rule's edit page.

Tags

Tags are used the same way they're used in your Shopify store's admin section: for organization. Tag a rule using the tag dialog (accessible via the rule's menu) to group it with others rules with the same tag.

Click on a tag to see all the rules with that tag. Equivalently, click on the tag in the navigation drawer to see the same rule grouping.

Use the tag dialog is to create, update, or destroy tags. Destroying a tag will remove it from each of the rules it was applied to, but will not otherwise affect any rules. Updating a tag will be effective everywhere it is applied: the updated tag will entirely replace the old tag.

Note: Rule tags in ifshop are isolated to ifshop; these tags have no effect on your shop, or anything else external to the app.

Event

Each and every rule has a singular event by which that rule is triggered. When the event occurs, the ifshop executes the rule's action in order from first to last.

A rule's event cannot be changed - if you'd like a rule with a different action, you'll need to go ahead and create a new one.

Actions

When you create a new rule, it will initially have no actions. To create a new action, use the action selection and Add Action button at the bottom of the rule edit page. Add as many actions as you like. Move an action up or down in the action sequence using that action's menu items, or permanently remove an action using the "Delete Forever" item in the same menu.

For control over which actions are executed, you can toggle each action on or off. When you create an action, it will default to toggled off. It may be best to keep the action toggled off until you're ready for it to run; otherwise, it might happen that the rule gets executed while you're in the process of editing it!

To edit an action, click on the action's header to see it expand. Filters (described below) are at the top, and the action details are at the bottom.

At the bottom of each action is a text field labeled "Activity log description". This is place for you to write out a description containing helpful information about the action. The description will appear in the activity log on the dashboard page.

Feature: Action descriptions support liquid! For example, you could have a description like "Add 'new-product' tag to {{ product.title }}."

For details on each type of action, check out the Actions section on the right.

Action Filters

Action filters are part of what make ifshop really useful. Instead of executing each action in the sequence every time the rule is triggered, you can focus in on the events you really care about. An action will not execute unless all of its filters evaluate to true -- if not all filters are true, ifshop will skip over that action and move on to the next one (with the exception of the "continue" action). Click the + button to add a filter, then adjust it to your preference:

  • To negate a filter, click the "If" or "Unless" button on the left.
  • Select the filter you'd like from the drop down menu and fill in the details to the right of the drop down.
  • If there isn't a filter in the drop down menu that meets your needs, use the "custom..." selection to write your own filter using liquid.

Feature: All action filter fields support liquid! For example, you could have a filter that said: "If the customer's email equals: {{ customer.email }}", which would always evaluate to true.

Note: If you have a filter in mind that you think would be generally useful, let me know and I'll add it to the drop down.

Note: A custom filter is written in liquid, but it is not the same as a liquid filter. The similar wording is merely a coincidence.