Skip to main content

Automatically disable unsold Magento 2 products after 1 year with Gmail approval

Workflow preview

Workflow preview
100%
Automatically disable unsold Magento 2 products after 1 year with Gmail approval preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow is designed for Magento 2 merchants who want to automatically identify and deactivate products that haven't been sold in the past 12 months, helping to maintain a clean and optimised ...

Best for

  • Document Extraction automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.if, n8n-nodes-base.httprequest, n8n-nodes-base.code, n8n-nodes-base.gmail, n8n-nodes-base.splitinbatches, n8n-nodes-base.merge, n8n-nodes-base.splitout

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Kanaka Kishore Kandregula.

Original n8n.io source

1.1 Workflow description

Title
Automatically disable unsold Magento 2 products after 1 year with Gmail approval
Workflow name
Automatically disable unsold Magento 2 products after 1 year with Gmail approval

This workflow is designed for Magento 2 merchants who want to automatically identify and deactivate products that haven't been sold in the past 12 months, helping to maintain a clean and optimised catalog.

This automation includes order analysis, product comparison, management approval, and automated product deactivation, with full reporting and transparency.

πŸ”§ What It Does
  • 1st of Every Month at 8 AM, it triggers a scheduled cleanup.
  • Calculates the date 12 months ago from the current day.
  • Fetches all Magento 2 orders created in the last 12 months via REST API.
  • Extracts all SKUs of products sold during that period.
  • Fetches the entire product catalog from Magento 2.
  • Compares all products with sold SKUs to determine which products had zero sales in the last year.
  • Prepares an HTML email report (including SKU, Name, Price, Status) of the unsold products.
  • Sends the report to the merchant (e.g., [email protected]) for approval via interactive email (Approve / Decline).
  • If approved, each product is automatically disabled (status updated to 1) in Magento 2 using the REST API.
  • Aggregates all disabled products and sends a confirmation email with a summary and product table.
  • Ensures safe operations with conditional logic and user review before taking any action.
🧠 Key Features
  • βœ… Fully automated detection of inactive inventory.
  • βœ… Uses n8n's Gmail Approval Node for human decision-making.
  • βœ… Works with Magento 2’s REST API and handles large product sets with batching and aggregation.
  • βœ… Includes fail-safe conditional checks (e.g., don’t run if no orders are found).
  • βœ… Clean HTML email reports with product metadata.
  • βœ… Modular and scalable for different business sizes or intervals.
πŸ“¦ Use Case Perfect for:
  • Magento 2 store owners or managers
  • Digital operations teams aiming for lean product catalogs
  • Agencies maintaining Magento-based ecommerce stores
  • Any business needing automated product lifecycle management
πŸ” Credentials Required
  • Magento 2 API Bearer Token (for reading orders and updating products)
  • Gmail OAuth2 (for sending approval and summary emails)
πŸ› οΈ Customizable Parameters
  • Trigger interval (currently set to monthly at 8 AM)
  • Email recipients for approval and notifications
  • Product status change (can be extended to delete or archive instead of disabling)
🧩 Workflow Stack
  • Trigger: Schedule (Monthly)
  • Nodes Used:
  • HTTP Request
  • Code (JavaScript)
  • IF Condition
  • Gmail (Approval & Notification)
  • Split Out / Split in Batches
  • Aggregate
  • Merge

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 3 - Fetch Orders since 1 year ago

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - Calculate date an year ago (ISO)

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Extract Sold SKUs from orders

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Get All Product Skus

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - Filter products NOT sold in last year

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Gmail User for Approval

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 9 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 10 - If1

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 11 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 12 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 13 - Disable Products

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 14 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 15 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 16 - Built Reporting Email

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Build Decision Email

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 20 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Automatically disable unsold Magento 2 products after 1 year with Gmail approval
Complexity advanced
Nodes 22
Categories Document Extraction
Author Kanaka Kishore Kandregula
Published 26 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6501/6501.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automatically disable unsold Magento 2 products after 1 year with Gmail approval do?

This workflow is designed for Magento 2 merchants who want to automatically identify and deactivate products that haven't been sold in the past 12 months, helping to maintain a clean and optimised ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.