Quick overview
This workflow captures Shopify checkout updates into an n8n Data Table, marks carts as purchased when Shopify orders are created, and every 15 minutes uses OpenAI to write localized abandoned-cart reminder emails that are sent via SMTP and logged back to the Data Table.
How it works
- Triggers on Shopify checkout updates and ignores checkouts that are completed or missing an email address.
- Normalizes the checkout data (customer details, line items, totals, locale, and recovery URL) and upserts it into an n8n Data Table keyed by the checkout token.
- Triggers on Shopify order creation events, extracts the checkout token, and updates the matching Data Table row to a purchased status to stop reminders.
- Runs every 15 minutes, loads open carts from the Data Table, and selects only those due for a reminder based on last activity, prior reminders, consent rules, and configured limits.
- Sends the cart context to OpenAI to generate a short subject and body in the customer’s language, then falls back to a built-in localized template if the AI output is missing or invalid.
- Sends the HTML reminder email via SMTP and, when sending succeeds, updates the Data Table with reminders sent and the last reminder timestamp.
Setup
- Add Shopify access token credentials and ensure webhook topics for checkouts/update and orders/create can be registered for your Shopify store.
- Create an n8n Data Table for abandoned carts, select it in all Data Table steps (upsert, get, and update), and ensure it includes fields like checkout_token, email, items, status, reminders_sent, and last_reminder_at.
- Add an OpenAI API credential for the chat model used to draft reminder content.
- Configure SMTP credentials for the Email node and set the store name and sender email in the Settings step to match an address your SMTP provider allows.
- Adjust reminder timing, maximum reminders, consent requirement, and per-run email limit in the Settings step to match your policy.
Requirements
- Shopify store with an Admin API access token (checkouts and orders scopes)
- OpenAI API key
- Any SMTP email account
- n8n version with Data Tables
Customization
- Change timings, number of reminders and default language in the Settings node
- Swap the OpenAI model for any other chat model
- Replace the SMTP node with Gmail, SendGrid or any email node
- Translate or restyle the fallback texts in the Build Email node