Skip to main content

Applying discounts in Shopify

In this tutorial, we'll show you how to apply discounts at checkout using Shopify and Talon.One.

Let's imagine you want to create a 20% discount in Shopify that applies to all orders over $100 in your store. You can do this by creating a discount function in Shopify and a rule in Talon.One. When a customer checks out, the discount is applied to their order.

Talon.One requirements

Shopify requirements

important
  • You are an Administrator user.
  • You have completed the basic setup of the Talon.One Shopify app.
  • (To discount individual items) You have synced the cart item catalog with your product inventory in Shopify.

Setting up the integration

1

Configure your Shopify store

Modify the template of your store so that on every cart update, the store calls the Create or update customer session endpoint of the Shopify Integration API.

The call must include the Shopify cart ID, which is used as the customer session ID in Talon.One, and a list of line items in the Shopify cart.

If you use Hydrogen, this involves modifying components in the /app/routes directory, specifically in the cart.jsx file. These components are responsible for fetching the data required for a specific page. For more information, see the Hydrogen documentation and a code sample on GitHub.

If you need further help, contact your Customer Success Manager.

2

Create the discount function in Shopify

Create a discount function to enable the data flow between Shopify and Talon.One. We recommend using only one discount function for all Talon.One discounts in your store.

  1. In Shopify, open Discounts.
  2. Click Create a discount.
  3. In the Talon.One section, select Talon.One discounts.
  4. Configure the discount function:
    • Discount title: Type a descriptive title, such as Talon.One discounts.
    • (Optional) Start and end dates: Ensure the start date aligns with your launch or testing needs, and leave the end date disabled.
      note

      These dates determine when Talon.One is contacted for discounts, not when individual discounts become active. To schedule discounts, use Talon.One's features, for example, campaign scheduling or coupon scheduling.

    • Discount applies to: Select which type of discounts you want to use with Talon.One (product, order, or shipping discounts). If you are unsure, select all three options.
  5. Click Create discount.

The Discounts page now shows the discount function you created.

3

Create an additional cost

To allow shipping discounts, create an additional cost in Talon.One with the following properties:

  • Scope: Cart (Session)
  • API name: shipping
4

Create a rule in Talon.One

  1. Open a campaign in the Application that is connected to your Shopify store.

  2. Depending on where you want to apply the discount, do one of the following:

    note
    • The title of the rule will be used as the discount title in Shopify.
    • Currently, the Talon.One app for Shopify allows you to apply up to one discount to each order, product, and shipping cost. Unlimited discounts per category is a feature planned for a future release.

    For this tutorial, we'll create a rule that applies a 20% discount to orders over $100:

    WhatNameProperties
    ConditionsCheck attribute value
      Cart Items Total (Current Session) is greater than 100
    EffectsDiscount session total
    • Discount name: 20% off
    • Discount value: [Session.Total] * 20%
  3. Save the rule.

  4. Activate the campaign.

5

Test the integration

  1. Add a product to your cart in Shopify and ensure that the cart total is over $100.
  2. Proceed to checkout.
  3. Verify that the discount is applied to your order.