# How to Automate Shopify Abandoned Cart Recovery using the API

- Tool: API Automations
- Difficulty: Intermediate
- Fix time: 30-60 minutes
- Compatibility: Shopify Standard plan; custom app with scopes: read_checkouts, read_customers, write_draft_orders
- Last updated: May 2026

## TL;DR

Build a custom abandoned cart recovery flow using Shopify's `checkouts/create` webhook and the GraphQL `abandonedCheckouts` query. The catch: the webhook fires on cart creation, not abandonment — you need a delay-and-check pattern (wait 1-3 hours, then query to confirm the checkout is still incomplete). Send recovery sequences via an external ESP, not Shopify's API. GraphQL cost: 1,000-point bucket, 50 pts/sec restore on Standard plans.

## Best practices

- Never email customers who completed their purchase — always verify abandonment with a fresh API call at the time of sending.
- Only recover checkouts that have an email address — anonymous checkouts account for 30-50% of all carts and cannot be recovered via email.
- Use Shopify's `abandonedCheckoutUrl` as the recovery link — it restores the customer's exact cart session without requiring re-login.
- Multi-step recovery sequences (1h email, 24h email with discount) recover 2-3x more carts than single-email campaigns.
- Set reasonable discount expiry — a draft order discount should expire within 48-72 hours to create urgency.
- Track recovery attribution — tag recovered orders in Shopify to measure campaign ROI.
- Respect customers who don't respond to the first two recovery touches — don't spam with more than 2-3 recovery attempts.
- Test the timing logic thoroughly — a bug that emails customers who just completed checkout is more damaging than not sending the email at all.

## Frequently asked questions

### When exactly does Shopify mark a checkout as abandoned?

Shopify marks a checkout as abandoned after 1 hour of inactivity — meaning 1 hour has passed since the last update to the checkout without a completed order. The `checkouts/create` webhook fires immediately when the checkout is created, not when it becomes abandoned. This is why you need a delay-and-check pattern: wait 1 hour after the webhook fires, then query `abandonedCheckouts` to see if the checkout is still incomplete.

### Does the abandonedCheckouts query require any special scopes?

Yes, you need the `read_checkouts` scope on your custom app to query `abandonedCheckouts`. If your app token was generated before you added this scope, you'll need to reinstall the app from the Dev Dashboard to get a new token with the updated scope.

### What if the customer doesn't have an email address in the cart?

If `email` is null on the checkout webhook payload, the cart cannot be recovered via email. Anonymous checkouts (no email, no account) typically represent 30-50% of all carts. For these, there's nothing you can do via API. Shopify's native exit-intent popups and cookie-based retargeting ads are the only options for anonymous abandonment.

### What happens when I hit the GraphQL rate limit?

Shopify returns HTTP 429. For GraphQL, you can also see throttling in `extensions.cost.throttleStatus.currentlyAvailable`. On Standard plans, the 1,000-point bucket restores at 50 pts/sec. The `abandonedCheckouts` query with lineItems costs ~30 points. Implement exponential backoff and stagger job processing to avoid all abandoned cart checks hitting simultaneously.

### Can I access the abandoned checkout data if the customer used guest checkout?

Yes — if the customer entered their email during guest checkout, you'll see it in the webhook payload and can query `abandonedCheckouts`. The distinction is login status: guest customers gave their email in the checkout form but didn't create an account. Their checkout is still recoverable as long as the email was captured before abandonment.

### Is Shopify's built-in abandoned cart email good enough, or do I need the API?

Shopify's built-in single abandoned cart email works well for simple stores. Build a custom API-based flow when you need: multi-step sequences (2-3 touch points), dynamic discount offers based on cart value, SMS recovery, custom timing logic, or integration with your CRM/ESP for unified customer profiles.

### Can RapidDev help build a custom abandoned cart recovery system?

Yes. RapidDev has built 600+ apps including full abandoned cart recovery pipelines with multi-step email sequences, dynamic discounting, and CRM integration. We handle the queue infrastructure, Shopify API integration, and ESP setup. Book a free consultation at rapidevelopers.com.

---

Source: https://www.rapidevelopers.com/api-automations/how-to-automate-shopify-abandoned-cart-recovery-using-the-api
© RapidDev — https://www.rapidevelopers.com/api-automations/how-to-automate-shopify-abandoned-cart-recovery-using-the-api
