Applying discounts to customer saved searches using the Segmentation API
This tutorial teaches you how to use the Segmentation API to apply discounts to existing
customerSavedSearches. The Segmentation API enables you to filter out specific customers for marketing, analytics, and reporting purposes
A list of customer segment IDs is automatically created from existing
customerSavedSearches to ease the migration from using
customerSavedSearches to customer
segments. If a
customerSavedSearch is unmigratable, then
segments aren't created for it.
This tutorial is for app developers who develop an app that uses customer saved searches.
RequirementsAnchor link to section titled "Requirements"
What you'll learnAnchor link to section titled "What you'll learn"
In this tutorial, you'll learn how to do the following tasks:
Step 1: Retrieve a list of Anchor link to section titled "Step 1: Retrieve a list of customerSegments from a shop"
customerSegments from a shop
You can use the
segments query from the GraphQL Admin API to return a list of
customerSegments from a shop. If the shop you are querying has
customerSavedSearches, and the
customerSavedSearches are compatible with
customerSegments, then the
customerSavedSearches are automatically converted to
You don't need to manually search for compatible customer saved searches in your shop, because the
segments query returns only the compatible customer saved searches as customer segments.
To retrieve a list of the first 250 customer segments from a shop, including compatible customer saved searches, use the following GraphQL query:
Step 2: Apply discounts to Anchor link to section titled "Step 2: Apply discounts to customerSegments"
To apply a 10%-off all items discount, named "Discount", to two
customerSegments, use the
- For more examples of how you can use the Segmentation API, refer to the Examples section.