Post-Purchase Upsell Email Generator for E-commerce - n8n Workflow

Use this comprehensive n8n workflow to automate personalized product upsells immediately after a Shopify purchase. It integrates custom recommendation logic via a Code n8n node and sends rich HTML emails.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • E-commerce store owners and managers.

  • Developers needing a robust n8n template for post-purchase marketing.

  • Users looking to implement custom logic (cross-selling algorithms) within an n8n workflow.

  • Marketing teams focused on maximizing Average Order Value (AOV).

Overview

Increasing Average Order Value (AOV) is critical for e-commerce success. This sophisticated n8n workflow provides a scalable solution for implementing immediate, highly targeted upsell and cross-sell campaigns following a customer purchase on Shopify. Instead of relying on static, generic emails, this n8n template leverages custom code to calculate optimal product recommendations based on the items just purchased.

The automation starts the moment an order is placed, waits a strategic 10 minutes to allow the customer to receive their standard confirmation, and then processes the logic. By dynamically retrieving product details and formatting them into a rich HTML email, this n8n workflow ensures a personalized and professional user experience, driving repeat business and boosting conversion rates.

How it Works

This n8n workflow executes a multi-step process ensuring timely and relevant communication:


  1. Order Detection (n8n Trigger): The workflow starts with the 'Order Created Trigger' (a Shopify n8n trigger) which listens for new orders in your store.

  2. Strategic Delay: The 'Wait 10 Minutes' n8n node pauses the flow. This delay is crucial for good customer experience, ensuring the upsell doesn't clash with the primary order confirmation email.

  3. Recommendation Logic: The 'Generate Recommendation IDs' n8n node, powered by custom JavaScript, processes the purchased items and determines a list of recommended product IDs for upsell or cross-sell.

  4. Conditional Check: The 'If Recommendations Exist' n8n node checks if the custom code successfully generated any IDs. If not, the flow stops.

  5. Data Retrieval Preparation: If IDs exist, the 'Split Recommended Products' n8n node iterates over each ID to prepare for data fetching.

  6. Shopify Data Fetch: The 'Get Product Details' n8n node fetches the detailed information (title, price, image URL) for each recommended product using the retrieved IDs.

  7. Data Consolidation: The 'Merge Product Details' n8n node re-aggregates the individual product details back into a single list.

  8. HTML Generation: The 'Format Recommendations HTML' n8n node uses custom code to render the product data into a polished, mobile-friendly HTML snippet for the email body.

  9. Email Delivery: Finally, the 'Send Upsell Email' n8n node sends the personalized email, completing the n8n workflow.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and import it directly into your n8n instance.

  2. Shopify Credentials: You must update the 'Order Created Trigger' and 'Get Product Details' n8n node with your Shopify API credentials (Shop Name and Access Token).

  3. Email Credentials: Update the 'Send Upsell Email' n8n node with your SMTP or email service provider credentials (e.g., SendGrid, Gmail, or your custom configuration).

  4. Custom Code Implementation: The core logic resides within the 'Generate Recommendation IDs' n8n node and the 'Format Recommendations HTML' n8n node. You must customize the JavaScript within these Code n8n nodes to match your specific recommendation algorithms and branding requirements.

  5. Activation: Once all credentials and custom code are configured, set the 'Order Created Trigger' to 'Active' to start listening for new Shopify orders. This n8n template is ready to boost your sales.

Node Details


  • Order Created Trigger (Shopify Trigger n8n node):

- Function: Initializes the entire n8n workflow when a new order is detected on Shopify.
- Key Configuration: Requires Shopify API credentials and is set to monitor the 'Order Created' event type.

  • Wait 10 Minutes (Wait n8n node):

- Function: Pauses execution for exactly 10 minutes, ensuring the upsell email is delivered at an optimal time post-purchase.
- Key Configuration: Wait for a fixed period (10 minutes).

  • Generate Recommendation IDs (Code n8n node):

- Function: Contains the core custom logic. It analyzes the incoming order data (e.g., purchased product SKUs) and outputs an array of recommended Product IDs.
- Key Configuration: Custom JavaScript implementation is mandatory here.

  • If Recommendations Exist (If n8n node):

- Function: Controls the flow path, proceeding only if the previous Code n8n node successfully generated recommendation IDs.
- Key Configuration: Checks for the presence of the ID array.

  • Get Product Details (Shopify n8n node):

- Function: Retrieves comprehensive product data (images, URLs, descriptions) from Shopify based on the recommended IDs generated by the custom code.
- Key Configuration: Operation set to retrieve product details.

  • Format Recommendations HTML (Code n8n node):

- Function: Takes the rich product data and transforms it into a clean, presentation-ready HTML structure suitable for embedding in an email.
- Key Configuration: Contains custom code for email template generation.

  • Send Upsell Email (EmailSend n8n node):

- Function: Sends the personalized upsell email to the customer using the aggregated and formatted HTML content.
- Key Configuration: Requires SMTP or Email Service credentials, sets the recipient dynamically using the order data, and uses the generated HTML body.

Related n8n Workflows

Paid

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
David Olusola
David Olusola

I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - [email protected]

Featured*