In this article you will learn how to create rules to control the dates and times a customer can qualify for your promotions.

Using Date or Time attributes you can create rules to have campaigns only run on certain days or on all days except those listed.

Defining specific dates and times where campaigns will take effect or not in the Rule Builder gives you a lot more flexibility and granularity with your promotions, making it more suitable than Start and End date scheduling for certain situations.

Let's create a scenario to show how you might use this feature.

For our example, let's say we run a travel company and we're selling tickets for journeys. We're going to create a campaign where customers redeeming coupons will get 10% off their ticket price, as long as the journey date is not on a public holiday.

Creating a Campaign

To begin with, let's set up a campaign with coupons so that we can start building rules.
If you haven't set up a campaign before, check out our article on Creating a Campaign.
Once that's ready, let's create an example of how you might use dates.

A company selling tickets like this will usually have a custom time attribute set up in their system to track the date and time of the journey cart item, so let's create one now.

Creating a time attribute with suggestions

If you haven't created an Attribute before, you might want to check out our article on Creating Attributes.

From your Admin dashboard:
  • Click "Manage Applications".
  • When the new page loads, click "Attributes".
  • Then click "Create Attribute".
In the Create Attribute page:
  • Set the Associated Entity to "Cart Item".
  • Then Attribute type to "Time".
  • Give this attribute a permanent internal (developer-facing) name. (eg. "travelDate")
  • Give it an editable Title (eg. Travel Date)
  • Add a short description of this attribute (eg. "The date on which this journey occurs.")
Finally, click the Suggestions field and select "Add Date" to open the calendar.
Here's where we're going to enter all the public holiday dates for this year.

Take a look through the calendar and add any date you'd like to this list by clicking on its number.
Doing this adds these dates to a convenient drop-down menu we'll use later in the rule builder.
When you've selected all the ones you'd like, click "Create Attribute" to finalise it.


Creating a date-based Cart Item Filter

If you haven't created one of these before, check out our article on Cart Item Filters.

Now that we have an attribute, let's build our simple rule; 
When a customer redeems a coupon, we will give them 10% off their ticket as long as the coupon is valid and the Travel Date is not a local holiday.

From the overview of the campaign we created earlier, select "Rule Builder", then:

  • Click "Add Rule".
  • Name the rule
  • Click "Filter Cart Items"
  • Choose "Set a filter condition"
Now to check if the date in question to one from the list, we'll need to build the condition:
  • Travel Date (The attribute we created earlier)
  • Is not one of
  • ‚Äč[Our holiday dates from earlier, picked from the drop down suggestions]

Here's our menu of suggestions we created earlier. You can pick and choose any of the dates you set out earlier for your filter; you can even pick or type new dates right here in the filter.
Let's call this filter "journeys_valid_for_discount" and save.

Creating a Condition

The condition for this rule will simply be "Coupon code is valid", to ensure that as well as being on a correct date, a valid coupon is being used.

Creating an effect

Lastly we create an Effect for the rule, which is a Per Item Discount, and we pass our new Cart Item Filter  "journeys_valid_for_discount" as the list of items.
Then we set it to take 10% off the price and save the rule.

When this campaign is activated, customers using a valid coupon will receive 10% off their ticket price as long as the journey doesn't happen on a public holiday.

Alternatively we could offer free shipping or award loyalty points, we could change it around and offer discounts ONLY on public holidays; anything we'd like, depending on our needs and which features we have activated on this Talon.One campaign.

Now you know how to create and get started with Dates and Times in Talon.One.

Next you might want to check out: