Rules

Printer-friendly versionPrinter-friendly version

The Rules module allows site administrators to create actions that are automatically triggered by various events when certain conditions are met.

3 PARTS TO RULES

Rules are made up of 3 parts:

  • Event - A rules event is what is used to trigger an action. Example: is viewed, After saving a new, After updating an, Before saving a, and Before deleting a.
  • Condition - A rules condition is a set of ‘if, and, or’ statements. In order for the rule's action to be executed, the combination of conditions needs to evaluate to TRUE.
  • Action - A rules action is simply a function call to do something. Example: send email, display a message, apply a coupon.

EXISTING EXAMPLES

There are rules set up on your IndieCommerce website by default, two you may be familiar with are:

  • E-mail customer checkout notification - This is the email that the customer receives after placing an order, its parts are:

    • Event: Customer completes checkout
    • Condition: n/a
    • Action: E-mail an order invoice
  • E-mail admin checkout notification - This is the email that the store receives after a customer places an order, its parts are:

    • Event: Customer completes checkout
    • Condition: n/a
    • Action: E-mail an order invoice

There are a few other rules set up by default on your site, which you may review by navigating to Configuration > Workflow > Rules.

USE CASES

Along with the default rules, you can create your own custom rules. Below, we have provided some common examples:

Navigate to: Configuration > Workflow > Rules

DISPLAY A MESSAGE ON THE SITE
In this example, we create a rule that displays a message to customers who select ‘In-Store Pickup’.

  1. Select ‘Add New Rule’
  2. Enter ‘Rule Name’ - Example: In-Store Pickup Ready Time
  3. Set the ‘React on Event’ to ‘Customer Completes Checkout’
  4. Save
  5. Find the ‘Rule’ you created in the list of ‘Active’ rules and select ‘Edit’
  6. Select ‘Add Condition’
  7. Set the ‘condition to add’ to ‘Order has a shipping quote from a particular method’
  8. Set the ‘Shipping Method’ to ‘In-store Pickup’
  9. Save
  10. Select ‘Add Action’
  11. Set the ‘action’ to ‘Show a message on the site’
  12. Set the ‘Value’ - this is the message that will be displayed to the customer Example: We will contact you when your order is ready for pick-up.
  13. Set the ‘Message Type’

    • Status - Green Bar
    • Warning - Yellow Bar
    • Error - Red Bar
  14. Save

Customers who have selected ‘In-store Pickup’ and have completed checkout, should now see this message.

APPLY A COUPON AUTOMATICALLY

In this example, we create a rule that applies a coupon automatically for orders of $25 or more. A coupon will need to be created first, if you’re not familiar with creating coupons review ‘Discount Coupons’ - Scenario 2 for instructions.

  1. Select ‘Add New Rule’
  2. Enter the ‘Name’ - Example: Automatic $10 Off 25 or more
  3. Set the ‘React on Event’ to ‘Check for Automatic Discounts’
  4. Save
  5. Find your new rule in the list and select ‘Edit’
  6. Select ‘Add Action’
  7. Set the ‘Action to Add’ to ‘Apply a coupon to current order’ and continue
  8. Set the ‘Value’ to the coupon you created
  9. Set the ‘Mode’ to ‘Apply this coupon as an automatic discount’
  10. Change the ‘Coupon Label’ if you wish to customize it
  11. Save

Customers who place an order totaling $25 or more should now receive $10 off automatically.

REDIRECT
In this example, we create a rule that automatically redirects a user back to a ‘Create’ page after new content has been saved.

  1. Select ‘Add New Rule’
  2. Enter ‘Rule Name’ - Example: Event Create Redirect
  3. Set the ‘React on Event’ to ‘After Saving New Content’
  4. Set the ‘Restrict by type’ - Example: Event
  5. Save
  6. Find the ‘Rule’ you created in the list of ‘Active’ rules and select ‘Edit’
  7. Select ‘Add Action’
  8. Set the ‘action’ to ‘Page Redirect’
  9. Set the ‘Value’ - this is the path to the page the user should be redirected to Example: node/add/event
  10. Save

Users who create and save a new event should automatically be redirected to the Create event page again.

CONDITIONS FOR SHIPPING QUOTES

In this example, we create a condition that allows a free shipping option to appear, when certain conditions are met.

Navigate to: Store > Configuration > Shipping Quotes

  1. Select ‘Add flat rate quote’
  2. Fill in:

    • Shipping method title -  Example: FREE Ground Shipping
    • Line item Label - Example: FREE Ground Shipping (7-14 days)
    • Base Price - Example: $0.00
    • Default product shipping rate - Example: $0.00
  3. Submit

Now that you have created your shipping option you need to add the condition to only allow it to appear when the conditions are met.

  1. Select ‘Conditions’ for the appropriate shipping method - Example: FREE Ground Shipping
  2. Select ‘Add Condition’
  3. Set the ‘Condition’ to ‘Check an order’s total’  
  4. Continue
  5. Set the ‘Value’ to the amount that needs to be met - Example: 50.00
  6. Set the ‘Order Total Comparison Type’ to ‘Total is greater than or equal to’
  7. Save

Customers who meet the set conditions should be offered free shipping. We recommend you go through the checkout process to confirm.

NOTE: We recommend placing the FREE shipping option first in the list of choices so that when it is offered it appears as the first option to customers.

CONDITIONS FOR PAYMENT METHODS

In this example, we create a condition that prevents customers who are purchasing ‘Event Tickets’ from opting to ‘Pay At Store’

Navigate to: Store > Configuration > Payment Methods

  1. Select ‘Conditions’ for ‘Pay at Store’
  2. ‘Select ‘Add condition’
  3. Set the ‘condition to add’ to ‘Check an order’s product classes’
  4. Set the ‘Product Class Value’ - Example: Event Ticket
  5. Enable the ‘Negate’ button
  6. Save

Customers who now purchase an ‘Event Ticket’ should not have the option of ‘Pay At Store’. We recommend you go through the checkout process to confirm.

Keep in mind these different scenarios can be modified to fit the needs of your store.  You’re always welcome to reach out to us with questions on how to set up a specific rule.

 

IndieCommerce Help Documents

 

About ABA

American Booksellers Association is a national trade association that supports and advocates for the success of independent bookstores. We provide members with education, networking opportunities, advocacy, resources, and technology. In turn our members support local schools through book fairs, donations and author visits; promote literacy; provide inclusive community centers; connect readers and books; add character to neighborhoods; champion and center diverse and new voices; and contribute to the local economy. We feel honored to support them in their work.

Contact

PRESS INQUIRIES: [email protected]

INDIECOMMERCE: [email protected]

ALL OTHER INQUIRIES: [email protected]

 

 

Copyright 2024 American Booksellers Association. BookWeb is a registered trademark of ABA.
Privacy Policy, Cookie Policy, Accessibility Statement