Skip to main content

Setting up strikethrough pricing

Strikethrough pricing consists in displaying 2 prices to the customer: the list price and the newly discounted price.

We can use Talon.One to help us achieve this but this is not a core feature of Talon.One. Consider this tutorial as an example of creative ways in which you can use Talon.One.

Understanding the context#

Let's imagine that we are selling bikes via our web shop. We have categories for our bikes such as mountain bikes or racing bikes.

We want to set up strikethrough pricing for all mountain bikes to show the new price being 10% off the original price.

Initial issues#

In the current context, we can think of the following issues:

  1. We can create a rule If category is "mountain bikes" then set a 10% discount on the cart's value.

    Rules are evaluated when a customer session is created or updated, in other words when a customer creates a shopping cart. This is not what we want because we want to display the prices when customers browse our catalog, not when they create a shopping cart. We must create fake sessions.

  2. If we use a rule for our use-case, we want to ignore any changes made by the rule execution because these rule executions are not connected to any real customer session. We can use dry requests for this.

  3. If we create large sessions to check all our products to find the discounted ones, we might trigger other promotion campaigns. Typically, you might have issues if you have product-bundling rules. We can use a custom attribute and check this attribute in our product-bundling rules.

Strikethrough pricing is achievable in Talon.One using a range of solutions discussed below. For help on this topic, contact your technical account manager.

Recommended solutions#

We can use 2 approaches:

  • Fetching the discounted prices in real-time. Every time a user displays a page of our product catalog, we run Talon.One's Rule Engine to check what discounts should be applied in the listing.
  • Fetching the discounted prices at night, and storing the discounted prices.

Fetching discounted prices in real-time#

To display the discounted prices in real-time, we must request the prices to Talon.One as the customers browse the catalog.

Pros:

  • We get real-time information, which is ideal if the rules managing the discounts are updated during the day.
  • Works well for large product catalogs.

Cons:

  • Browsing the catalog triggers a request to Talon.One, which might impact the catalog browsing experience so we must set up a caching strategy.
  • We must find a balance between fewer larger requests versus several smaller requests as the customer browse the catalog.

The workflow looks as follows:

Representation of the workflow

The workflow relies of the following steps. Whenever the customer displays a product page:

  1. Send a request to the Update customer session endpoint:

    1. Create a fake session. You can either:

      • Use a specific naming pattern for fake sessions, or
      • Add a custom attribute in the payload to identify them as fake. See the example below.
      important

      If you use product bundling in your Application, use the custom attribute technique and ensure this attribute doesn't exist in your product bundling-related rules.

    2. Do not bind the session ID to any customer ID.

    3. Set the dry parameter to true to ignore changes involved by this rule. See dry runs for more information.

  2. Check the response.

  3. Cache the new prices. Decide how to manage you cache to optimize for performance.

    important

    Smart-caching is required. Skipping the caching step will result in degraded performance for your customers, and potential rate limiting from Talon.One.

  4. Display the new prices in the web shop.

Example request#

Let's imagine the user displays a page with 2 bikes, we send the following request to check for potential discounts:

CURL -X PUT https://mycompany.talon.one/v2/customer_sessions/a_fake_session_id?dry=true -d'{  "customerSession": {    "state": "open",    "cartItems": [      {        "name": "bike1",        "sku": 124102847,        "quantity": 1,        "price": 99.99,        "category": "mountain bikes",      },      {        "name": "bike2",        "sku": 467334884,        "quantity": 1,        "price": 199.99,        "category": "racing bikes",      }    ],    "attributes": {        "fake_session": true // custom attribute if using product bundling    }  }}'

Fetching discounted prices at night#

To display the discounted prices without real-time requests, we can fetch all the prices at night, store them and display them.

Pros:

  • The requests are larger and slower but they happen outside of busy hours.
  • No rate limiting issues.
  • Ideal for small product catalogs.

Cons:

  • If the rule(s) that sets the discounts is updated during the day, we have to wait until the next day for the new prices to be displayed.

The process looks as follows:

Representation of the workflow

The process works as follows:

The workflow relies of the following steps.

  1. At night, send a request to the Update customer session endpoint:

    1. Create a fake session. You can either:

      • Use a specific naming pattern for fake sessions, or
      • Add a custom attribute in the payload to identify them as fake. See the example below.
      important

      If you use product bundling in your Application, use the custom attribute technique and update your product-bundling rules to ensure this attribute does not exist.

    2. Insert as many cart items in the session as possible. Create more sessions if needed.

    3. Do not bind the session ID to any customer ID.

    4. Set the dry parameter to true to ignore changes involved by this rule.

  2. Check the response. Let's assume some products are to be discounted.

  3. Store the new prices.

  4. Display the new prices in the web shop.

Example request#

Let's imagine we have 50 bikes in our product catalog, we insert all of them in the session:

CURL -X PUT https://mycompany.talon.one/v2/customer_sessions/a_fake_session_id?dry=true -d'{  "customerSession": {    "state": "open",    "cartItems": [      {        "name": "bike1",        "sku": 124102847,        "quantity": 1,        "price": 99.99,        "category": "mountain bikes",      },      //      // 48 more bikes      //      {        "name": "bike50",        "sku": 467334884,        "quantity": 1,        "price": 199.99,        "category": "racing bikes",      }    ],    "attributes": {        "fake_session": true // custom attribute if using product bundling    }  }}'

Related links#