🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Magento 2 + Gmail: approve and disable dead SKUs

Lisa Granqvist Partner Workflow Automation Expert

Your Magento catalog quietly bloats over time. Old variants, test SKUs, seasonal leftovers. They don’t just “sit there” either. They clutter search, confuse shoppers, and make merchandising work feel heavier than it should.

eCommerce managers feel it when reporting starts to drift. Store owners notice it when the site looks messy. And the ops person who “owns Magento” ends up doing Magento SKU cleanup automation by hand, one filter and CSV export at a time.

This workflow finds products with zero sales in the last 12 months, emails you an approval report in Gmail, and only then disables those SKUs. You’ll learn what it does, what you need, and how to roll it out safely.

How This Automation Works

Here’s the complete workflow you’ll be setting up:

n8n Workflow Template: Magento 2 + Gmail: approve and disable dead SKUs

Why This Matters: Catalog Bloat That Costs You Sales

Dead SKUs create a slow leak in your store. Search results show products nobody buys, category pages get longer, and the “real” products are harder to find. Then the team compensates by adding more filters, more manual QA, and more one-off rules. It’s not dramatic in a single day. But over a month, you lose time, you lose clarity, and you risk disabling the wrong item because you’re working from a half-trusted export or an outdated report.

It adds up fast. Here’s where the manual approach usually breaks down.

  • Pulling 12 months of orders and extracting SKUs turns into a recurring “half-day task” on someone’s calendar.
  • Catalog-wide comparisons are easy to get wrong, especially when variants, bundles, or renamed products are involved.
  • Teams delay cleanup because nobody wants to be responsible for disabling a product without review.
  • When you finally do prune the catalog, there’s often no clean audit trail of what changed and why.

What You’ll Build: Monthly Unsold SKU Review + Safe Deactivation

This automation runs on a schedule (the first of every month at 8 AM). It calculates the date from 12 months ago, then pulls your Magento 2 orders created within that window through the REST API. From those orders, it builds a list of SKUs that actually sold. Next, it fetches your full product catalog, compares it against the sold list, and produces a clean “unsold products” set. You get an HTML report in Gmail with SKU, name, price, and status. You click Approve or Decline. Only if you approve will the workflow loop through the list in batches and disable those products, then email a summary of what was changed.

So you go from “someone needs to figure out what’s dead” to a consistent monthly review. Magento 2 does the data, Gmail handles the decision, and n8n performs the updates with safeguards.

What You’re Building

Expected Results

Say your store has about 5,000 products. A typical manual cleanup looks like: export orders (about 30 minutes), export product catalog (another 30), build a sold-SKU list and compare (about 1–2 hours), then double-check the “unsold” list with someone else (another 30 minutes). That’s roughly 3 hours per month, and it’s easy to push off. With this workflow, you spend a few minutes reviewing the Gmail report and clicking Approve or Decline, then wait for the batch updates and the summary email. Most teams get those 3 hours back, and the results are more consistent.

Before You Start

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Magento 2 for orders and catalog access
  • Gmail to send approvals and summaries
  • Magento 2 API Bearer Token (create it in Magento admin integrations)

Skill level: Intermediate. You’ll connect accounts, paste an API token, and sanity-check a few test runs before turning it on.

Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).

Step by Step

A monthly schedule kicks it off. On the first day of the month at 8 AM, n8n starts the run and calculates the “12 months ago” cutoff date so the logic always stays current.

Magento order data becomes a sold-SKU list. The workflow pulls all Magento 2 orders created within the last year via HTTP requests, then extracts the SKUs that actually sold. If no orders are found, it stops, which prevents weird edge cases from causing a bad cleanup.

Your full catalog gets compared against reality. Next it fetches all product SKUs, filters out anything that appears in the sold list, and assembles an “unsold products” report with helpful context (SKU, name, price, status). This is the part you normally do with exports and spreadsheets.

Gmail collects approval, then Magento updates in batches. You receive an interactive Gmail approval email (Approve or Decline). If approved, n8n loops through the unsold SKUs using batch processing and updates each product’s status through the Magento 2 REST API. A final summary email lands in your inbox so you have a clear record.

You can easily modify the “12 months” window to a different timeframe based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Scheduled Trigger

This workflow runs on a monthly schedule to review unsold products and request approval for deactivation.

  1. Add and open Scheduled Run Trigger.
  2. Set the schedule rule to run every month with Trigger At Hour set to 8.
  3. Ensure the output connects to Compute Date 12 Months Back.

Step 2: Connect Magento Order and Product Retrieval

These nodes fetch orders from the past year and the complete product catalog for comparison.

  1. Open Retrieve Orders Past Year and set URL to =https://magekwik.com/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=created_at&searchCriteria[filter_groups][0][filters][0][value]={{$json["sixMonthsAgo"]}} 00:00:00&searchCriteria[filter_groups][0][filters][0][condition_type]=gteq&searchCriteria[pageSize]=0.
  2. Set Authentication to genericCredentialType and Generic Auth Type to httpBearerAuth.
  3. Open Retrieve All Product SKUs and set URL to =https://magekwik.com/rest/V1/products?searchCriteria[pageSize]=0 with the same bearer authentication settings.

Credential Required: Connect your httpBearerAuth credentials in both Retrieve Orders Past Year and Retrieve All Product SKUs.

Step 3: Set Up Date Calculation and SKU Processing

The workflow calculates the lookback date, extracts sold SKUs, and filters for unsold products. Multiple code nodes are used for this logic—configure them as provided.

  1. In Compute Date 12 Months Back, keep the JavaScript Code that sets sixMonthsAgo using date.setMonth(date.getMonth() - 12).
  2. In Check Items Present, set the condition Left Value to ={{ $json.items.length }} with the boolean check to true.
  3. In Derive Sold SKU List, keep the provided JavaScript that builds soldSkus from order items.
  4. In Filter Unsold Products, keep the JavaScript that compares the product list to Derive Sold SKU List using $('Derive Sold SKU List').first().json.soldSkus.

Filter Unsold Products outputs to both Combine Branch Data and Compose Approval Email in parallel.

Step 4: Configure Approval Email and Decision Logic

This branch builds the approval email, sends it for review, and checks the approval response before continuing.

  1. In Compose Approval Email, keep the HTML table generation JavaScript for htmlBody and count.
  2. Open Send Approval Email and set Send To to [YOUR_EMAIL].
  3. Set Subject to =Approve disabling {{ $json.count }} unsold products and Message to the provided template containing {{ $json.htmlBody }}.
  4. Ensure Operation is set to sendAndWait to collect the approval response.
  5. In Approval Decision Check, set Left Value to ={{ $json.data.approved }} with the boolean check to true.

Credential Required: Connect your Gmail credentials in Send Approval Email.

Step 5: Configure Deactivation Pipeline and Reporting

Approved items are expanded, processed in batches, deactivated via API, aggregated, and reported via email.

  1. In Combine Branch Data, set Mode to chooseBranch and Use Data Of Input to 2.
  2. In Expand Unsold List, set Field To Split Out to unsold.
  3. In Iterate Item Batches, keep Reset set to false so batch looping continues.
  4. In Deactivate Products, set URL to =https://magekwik.com/rest/default/V1/products/{{ $json.sku }}, Method to PUT, and JSON Body to the provided status payload.
  5. In Aggregate Product Data, set Aggregate to aggregateAllItemData and Fields To Include to sku,name,price,status.
  6. In Assemble Report Email, keep the HTML table JavaScript and ensure it outputs htmlBody and count.
  7. In Notify Deactivation Email, set Send To to [YOUR_EMAIL], Subject to ={{ $json.count }} products have been deactivated, and Message to =The following {{ $json.count }} products have been disabled.\n\n{{ $json.htmlBody }}.

Credential Required: Connect your httpBearerAuth credentials in Deactivate Products.

Credential Required: Connect your Gmail credentials in Notify Deactivation Email.

Step 6: Test and Activate Your Workflow

Run a manual test to verify API responses, email approvals, and deactivation behavior before enabling the schedule.

  1. Click Execute Workflow to run the workflow manually from Scheduled Run Trigger.
  2. Confirm that Send Approval Email delivers the approval email and that approving it triggers Approval Decision Check to pass.
  3. Verify that Deactivate Products receives items in batches and returns successful responses.
  4. Check that Notify Deactivation Email sends a report containing a table of deactivated products.
  5. Once confirmed, toggle the workflow to Active to enable monthly automation.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Troubleshooting Tips

  • Magento 2 credentials can expire or need specific permissions. If things break, check the Magento Admin integration token and API role permissions first.
  • If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Quick Answers

What’s the setup time for this Magento SKU cleanup automation?

About 30 minutes if your Magento token and Gmail are ready.

Is coding required for this SKU cleanup?

No. You’ll mostly connect accounts and paste your Magento 2 API token. The workflow’s logic is already built, so it’s configuration and testing, not development.

Is n8n free to use for this Magento SKU cleanup automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in any email sending limits on your Gmail/Google Workspace account.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I modify this Magento SKU cleanup automation workflow for different use cases?

Yes, and you probably should. You can change the “12 months ago” logic in the date calculation code, update the email recipient in the Gmail approval node, and swap “disable” for a different lifecycle action by adjusting the Magento update request. Common tweaks include using a 6-month window, excluding certain attribute sets or categories, and sending approvals to a shared operations inbox.

Why is my Magento 2 connection failing in this workflow?

Most of the time it’s an invalid or expired Bearer token, so generate a new one and update the credential used by the HTTP Request nodes. If the token is fine, check that the integration role can read orders and update products. Another common culprit is the base URL being slightly wrong (missing store view path, wrong domain, http vs https), which makes the API look “down” when it isn’t.

What volume can this Magento SKU cleanup automation workflow process?

Quite a lot, because it uses batching for large product sets. On n8n Cloud, your practical limit is the plan’s monthly executions, while self-hosting is mainly constrained by your server resources and Magento API responsiveness. For many small-to-mid stores, processing a few thousand products in a monthly run is normal. If you have a very large catalog, keep the batch size modest so Magento doesn’t throttle you.

Is this Magento SKU cleanup automation better than using Zapier or Make?

Often, yes. This kind of workflow needs conditional checks, batching, and multi-step branching (including a human approval gate), and n8n handles that without turning every “extra path” into a cost surprise. You also get a solid self-hosting option, which is handy when you want predictable runs each month. Zapier or Make can still work if your store is small and you’re only doing lightweight notifications, not catalog updates. If you’re unsure, Talk to an automation expert and get a quick recommendation based on your catalog size.

Once this is running, catalog cleanup stops being a dreaded project and becomes a quick monthly decision. The workflow handles the repetitive work so you can focus on what actually sells.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal