In short: In Shopify customer segments, combine the Abandoned checkout date filter (abandoned_checkout_date) with the operator >= and a date offset (for example, -7d) to find customers whose most recent abandoned checkout falls within the period you specify. You can use the segment as the target of a discount code or automatic discount, or as the recipients of a Shopify Messaging email campaign, so you can set up coupons for customers who abandoned their carts without installing any additional apps.
Howdy is an app that adds a sign-up form to Shopify's new customer accounts. Fields collected with the sign-up form, such as addresses and birthdays, are saved as standard Shopify customer information or customer metafields, and you can combine them with checkout activity such as the abandoned checkout date covered in this article to build segments.
After following the steps in this article, you'll have a segment of only the customers who added products to their cart but didn't complete checkout, and you'll be able to issue discount codes to that segment and send it email campaigns. Shopify's built-in features evaluate the abandoned checkout date condition, so you don't need any additional apps or extra customer data. You can adjust how long it takes before a checkout counts as abandoned just by changing the number in the date offset.
Key points
- Set an operator and a date offset on the Abandoned checkout date filter (abandoned_checkout_date) in customer segments to filter customers by the date of their most recent abandoned checkout
- Write the date offset as a number combined with a unit (d, w, m, or y), such as -7d
- Create the segment in the query editor under Customers > Segments > Create segment
- From the segment's details page, use Use segment to create discounts and email campaigns
- An automatic discount can target up to 5 segments, and a discount code can target up to 100 segments
- You can also combine the abandoned checkout condition with other filters, such as email marketing subscription status, using AND
How do you set the condition to segment customers who abandoned their carts?
Use the Abandoned checkout date filter (abandoned_checkout_date) in customer segments. This filter narrows down customers by the date they most recently abandoned a checkout.
You can use these operators: is on a specific date =, is not on !=, on or before <=, before <, on or after >=, after >, BETWEEN for a date range, IS NULL for no value, and IS NOT NULL for any value. You can enter the value as an absolute date (YYYY-MM-DD) or as a date offset (such as -4w or -10y, a number combined with the unit d, w, m, or y). To find customers whose most recent abandoned checkout was within the past week, write abandoned_checkout_date >= -7d. For the past 8 months, write abandoned_checkout_date > -8m. Date values are in whole days and depend on your store's time zone.
Source: Shopify Help Center: "Shopify-based customer segment filters"
What are the steps to create a customer segment?
You create a customer segment by building a ShopifyQL (Shopify Query Language) query in the query editor under Customers in the Shopify admin. The steps are as follows.
- In the Shopify admin, go to Customers
- Click Segments
- Click Create segment to open the query editor
- Choose the Abandoned checkout date filter, and set the operator
>=and a date offset value - Click Run query (or ▹ Run), and check the matching customers in the list below the editor and the customer count above the editor
- Click Save segment, enter a name for the segment, and click Save
The query editor already contains the clauses FROM customers and SHOW customer_name, note, subscription_status, location, orders, amount_spent, and you customize the segment by adding filters, operators, and values to the WHERE clause. If you'd rather create a segment from a plain-language description, you can also ask Sidekick something like: Create a segment of customers whose last order was more than 90 days ago and who are subscribed to email marketing.
Instead of building the conditions from scratch, you can also start from a template. Under Customers, click the Templates icon, optionally filter by category, and click a template card. The matching filter name, operator, and value are filled in automatically in the query editor.
How to create a segment based on dormant customers is explained in How to segment dormant customers in Shopify and send coupons: setting a last order date condition.
Source: Shopify Help Center: "Creating customer segments"
How do you send coupons to an abandoned checkout segment?
On the details page of the segment you created, click Use segment > Discount, choose the discount type (Amount off products, Amount off order, Buy X get Y, or Free shipping), and create the discount.
You can also add the segment as a target of an existing discount. In the Eligibility section of the discount's edit page, choose Customer segments, select the abandoned checkout segment you created, and click Add. There's a limit on how many customer segments a discount can target: up to 5 per automatic discount and up to 100 per discount code.
Sources: Shopify Help Center: "Managing customer segments" / Shopify Help Center: "Managing and editing discounts"
Area-limited coupons that combine conditions such as prefecture are explained in How to segment customers by prefecture in Shopify and send coupons: area-limited campaigns.
Can you also send an email campaign to customers who abandoned their carts?
Yes. On the segment's details page, open Use segment, go to the Shopify Messaging email campaign editor, and choose the abandoned checkout segment you created as the recipients.
If you want to keep a record of the customers included in an email campaign, you can also export a customer CSV file that contains only the customers in the selected segment.
Only customers who are subscribed to email marketing receive the message. Shopify Messaging checks for valid subscriber email addresses, so the number of customers who actually receive the campaign may be smaller than the number of customers in the segment.
Source: Shopify Help Center: "Managing customer segments"
Can you narrow down a segment by combining multiple conditions?
Yes. When you use multiple filters, connect the conditions with the AND and OR connectors. AND narrows the segment to customers who meet all of the conditions, and OR widens it to customers who meet any of them.
For example, to narrow the segment to customers who are subscribed to email marketing and have placed 5 or more orders, connect the conditions with AND, like email_subscription_status = 'SUBSCRIBED' AND number_of_orders >= 5. To widen it to customers who are subscribed to email marketing or have placed 5 or more orders, connect them with OR. When you use both AND and OR, filters connected with AND are applied before filters connected with OR, so group filters with parentheses to get the combination you intend. For example, a segment limited to email subscribers who have spent more than US$100 or placed 5 or more orders is written with parentheses, like (amount_spent > 100 OR number_of_orders >= 5) AND email_subscription_status = 'SUBSCRIBED'.
Source: Shopify Help Center: "Customer segment components"
Can you create a new segment from an existing customer segment?
Yes. The Shopify admin includes default segments that show Shopify as the creator, as well as customer segments you've already created, and you can use these as a starting point to build a new segment.
- Go to Customers > Segments
- In the segment list, click the existing customer segment you want to start from
- In the query editor, make changes to match your abandoned checkout conditions
- Click Run query (or ▹ Run), and check the list and count of matching customers
- Click Save segment. To save it as a new segment, click Save as new segment and enter a new name
Source: Shopify Help Center: "Creating customer segments"
How do you check that everything works after setup?
New customers who match the criteria of your abandoned checkout segment are added to the segment automatically, and existing customers who no longer match the criteria are removed from it automatically.
If an individual customer matches the criteria of multiple segments, they're added to every segment whose requirements they meet. When you edit a segment, click Apply in the editor, check that the customer list shown below the editor is what you expect, and then click Save segment. Test orders and deleted orders are excluded from customer segmentation calculations. The customer count shown on the segments index page is updated when you open the segment's details page, or when an app such as Shopify Messaging uses the segment.
Source: Shopify Help Center: "Managing customer segments"
Related articles
- How to segment dormant customers in Shopify and send coupons: setting a last order date condition
- How to segment customers by prefecture in Shopify and send coupons: area-limited campaigns
Frequently asked questions
Try Howdy free for 14 days
You can segment customers who abandoned their carts and send them coupons using only Shopify's built-in customer segments. Our dedicated team creates customer metafields, sets up sign-up form fields, and places blocks on the profile page for you, free of charge.




