Skip to main content

20% off when session value >200

Prerequisites
Before you start, ensure you:
  1. Create your Integration API key.
  2. If you haven't done so already, fork our Sample Campaigns collection in Postman: Run in Postman.
  3. In the Campaign Manager, open the EASY-DISCOUNT: 20% off when session value greater than $200 demo campaign and click Activate Campaign.
  4. Open the Rule Builder to get some context.

Let's create a promotion rule that provides a 20% discount to every customer whose session value reaches $200.

This tutorial builds upon the Always triggering a discount tutorial, where we learned how to set up a rule that always triggers. In this tutorial let's create our first condition to ensure the discount is only applied to customer sessions whose value exceeds 200USD.

note

The currency for this example is USD. The currency can be edited in the details of your Application.

Creating the conditional discount promotion

In the current scenario, let's use one rule and name it 20% off with basket value >200.

Condition

Talon.One offers many conditions. In our case we need the following condition:

  1. Click Add condition and select Check attribute value.

    This condition allows you to check the value of an attribute against another value, or another attribute.

  2. Click Customer Name (customer profile) to replace it.

  3. Search for Session Total (Current Session) and select it.

  4. Replace is equal to with is greater than.

  5. In the field right of is equal to, type 200 and press enter.

This condition means that we are now checking the value of the Session Total (Current Session) attribute and if this value is greater than $200, this condition is true and Talon.One triggers the discount effect.

Effect

Let's set the Discount session total effect:

  1. Set the Name to something descriptive, such as 20% off.
  2. Set the Discount value to [Session.Total]*20%:
    1. Click Add an attribute ( Plus sign. ).
    2. Search for the Session Total (Current Session) attribute and select it.
    3. Back in the Discount value field, type * 20% to complete the discount value.

As in the previous tutorial, we calculate the discount value using the same Session total attribute.

Discount session total: Name is 20% off and Discount value is [Session.Total]*20%.

Running the campaign

To run the campaign, use the following payload sent to the Integration API's Update customer session endpoint:

To trigger the rule, the session value must be greater than 200, which is the sum of all cart items. In this case, let's share one item for 233USD.

Sending a session update
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "5720GCAJ428",
"state": "closed",
"cartItems": [
{
"name": "ProductA",
"sku": "sku-00001",
"quantity": 1,
"price": 233,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [
""
],
"referralCode": "",
"attributes": {},
"additionalCosts": {}
},
"responseContent": []
}'
Key Takeaways
  • Attributes can be used in effects, but also in conditions.
  • For more control, we can check for specific events to trigger effects at specific moments in the life cycle of the customer session.
  • You can use several conditions in one rule.
  • By default, when using several conditions, all of them must be true for the effects to be applied.