Skip to main content

Discounting bundles

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 ADVANCED-BUNDLE: $50 off bundled products demo campaign and click Activate Campaign.
  4. Open the Rule Builder to get some context.

Let's create a promotion rule that awards customers with a $50 pro-rata discount per bundle of 1 bike + 2 helmets found in their sessions.

Creating the promotion

Cart item filters

Let's start by creating the cart item filters. We need them to identify helmets and bikes. Then we'll create a bundle based on these items. We've already used cart item filters to check the category of cart items in the Different discounts for different categories tutorial.

  1. Click Add Filter.

  2. Click Add Filter Step and select Filter items by condition.

  3. Set the filter to Item category (Item) is equal to Road Bikes.

  4. In Save As, type RoadBikes and click Save Filter.

    This cart item filter returns a list of cart items.

Repeat the same steps to create a filter to find items in the Helmets category and count them.

Creating the bundle definition

To bundle the items, let's create a bundle definition:

  1. Click Bundle Definitions > Add Bundle Definition.
  2. In Name, type 1RoadBike2Helmets.
  3. In List of cart items, select RoadBikes and choose 1 item.
  4. Click Add list.
  5. In List of cart items, select Helmets and choose 2 item.

We have a bundle definition composed of 1 item from our RoadBikes cart item filter, and 2 items from the Helmets cart item filter. The bundle definition will create as many bundles as possible from the current state of the cart.

We know how many bundles are created thanks to the Count (1RoadBike2Helmets) attribute. This attribute is created automatically with the bundle definition.

Rule

Let's create the rule to trigger the discount:

  • Condition: Check attribute value and compose the following expression: Count (1RoadBike2Helmets)is greater than or equal to 1

    This check that our bundle definition managed to create a least one bundle.

  • Effect: Discount bundles pro rata and select:

    • Bundle definition: 1RoadBike2Helmets
    • Discount Name: $50 off a bundle of items
    • Discount value for each bundle: 50

Running the campaign

To run the campaign, we send a suitable session to the Integration API's Update customer session endpoint.

The session contains 2 helmets and 1 road bike, which is the bundle definition.

Sending a session update
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "{{integrationId}}",
"state": "closed",
"cartItems": [
{
"name": "ProductC",
"sku": "sku-00004",
"quantity": 2,
"price": 200,
"Category": "Road Bikes",
"weight": 0,
"position": 0,
"attributes": {}
},
{
"name": "ProductD",
"sku": "sku-00005",
"quantity": 1,
"price": 49.99,
"Category": "Helmets",
"weight": 0,
"position": 0,
"attributes": {}
},
{
"name": "ProductE",
"sku": "sku-00006",
"quantity": 1,
"price": 39.99,
"Category": "Helmets",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [
""
],
"referralCode": "",
"attributes": {},
"additionalCosts": {}
},
"responseContent": []
}'
Key Takeaways
  • You can bundle items with a cart item filter or use the bundle feature.