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., kmyprojects@gmail.com) 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
Automatically Disable Unsold Magento 2 Products After 1 Year with Gmail Approval
This n8n workflow automates the process of identifying and disabling unsold Magento 2 products that have been in stock for over a year, incorporating a human approval step via Gmail. This ensures that old, stagnant inventory is removed from the storefront while providing an opportunity for review before changes are applied.
What it does
This workflow performs the following actions:
- Schedules Execution: Runs automatically on a defined schedule (e.g., daily, weekly).
- Fetches Magento Products: Makes an API request to Magento 2 to retrieve a list of products.
- Filters Unsold Products: Processes the retrieved products to identify those that have been in stock for more than one year and have not been sold.
- Generates Approval Request: Creates a summary of the identified products and sends an email via Gmail to a designated approver, requesting confirmation to disable these products.
- Waits for Approval: Pauses the workflow execution until a response (approve/deny) is received from the Gmail approval email.
- Processes Approval:
- If approved, it proceeds to disable the products in Magento 2.
- If denied, it terminates the workflow without making any changes.
- Disables Products (if approved): For each approved product, it sends an API request to Magento 2 to update its status to disabled.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running instance of n8n.
- Magento 2 API Access:
- A Magento 2 instance.
- API credentials (e.g., OAuth 1.0a consumer key and secret, or a bearer token) with permissions to read product data and update product status.
- Gmail Account:
- A Gmail account configured as a credential in n8n.
- The Gmail account must have permissions to send and receive emails.
Setup/Usage
- Import the Workflow:
- Copy the provided JSON code.
- In your n8n instance, go to "Workflows" and click "New".
- Click the three dots (...) in the top right corner and select "Import from JSON".
- Paste the JSON code and click "Import".
- Configure Credentials:
- Locate the "HTTP Request" node (ID: 19) and configure your Magento 2 API credentials. This typically involves setting up an OAuth 1.0a or Bearer Token credential.
- Locate the "Gmail" node (ID: 356) and configure your Gmail account credentials. This will likely require setting up a Google OAuth2 credential.
- Customize Workflow Nodes:
- Schedule Trigger (ID: 839): Adjust the schedule to your desired frequency (e.g., daily, weekly, monthly).
- HTTP Request (ID: 19):
- Update the Magento 2 API endpoint for fetching products.
- Modify the query parameters to filter products as needed (e.g.,
status,created_at,type_id).
- Code (ID: 834): This node likely contains the logic to filter products based on the "in stock for over a year" condition. You may need to adjust the date calculation or other filtering criteria to match your specific business rules.
- Gmail (ID: 356):
- Set the "To" email address for the approver.
- Customize the subject and body of the approval email to provide clear instructions and product details.
- Ensure the "Wait for Approval" option is correctly configured.
- HTTP Request (within the "If" branch for approval): Update the Magento 2 API endpoint and request body to correctly disable products based on their
skuorid.
- Activate the Workflow: Once all configurations are complete, activate the workflow by toggling the "Active" switch in the top right corner of the workflow editor.
Related Templates
Daily Magento 2 customer sync to Google Contacts & Sheets without duplicates
Automatically sync newly registered Magento 2 customers to Google Contacts and Google Sheets every 24 hours β with full duplication control and seamless automation. This workflow is a plug-and-play customer contact automation system designed for Magento 2 store owners, marketers, and CRM teams. It fetches customer records registered within the last 24 hours (from 00:00:00 to 23:59:59), checks against an existing Google Sheet to avoid reprocessing, and syncs only the new ones into Google Contacts. This ensures your contact list is always fresh and up to date β without clutter or duplicates. β What This Workflow Does: Automates Customer Syncing Every day, it fetches newly registered Magento 2 customers via API based on the exact date range (midnight to midnight). Deduplicates Using Google Sheets A master Google Sheet tracks already-synced emails. Before adding a customer, the workflow checks this list and skips if already present. Creates Google Contacts Automatically For each unique customer, it creates a new contact in your Google Contacts, saving fields like first name, last name, and email. Logs New Entries to Google Sheets In Google Sheets, it even records magento 2 customer group, createdat, websiteid & store_id After syncing, it adds each new email to the tracking sheet, building a cumulative record of synced contacts. Fully Scheduled & Automated Can be scheduled with the Cron node to run daily (e.g., 12:05 AM) with no manual intervention required. π§ Modules Used: HTTP Request (Magento 2 API) Date & Time (for filtering registrations) Google Sheets (for reading/writing synced emails) Google Contacts (for contact creation) Set, IF, and Merge nodes (for control logic) Cron (for scheduling the automation) πΌ Use Cases: Keep your email marketing tools synced with Magento 2 customer data. Build a CRM-friendly contact base in Google Contacts without duplicates. Share customer data with sales or support teams through synced Google Sheets. Reduce manual work and human error in data transfer processes. π Credentials Required Magento 2 Bearer Auth: Set up as a credential in n8n using your Magento 2 API access token. Google API π Category E-commerce β Magento 2 (Adobe Commerce) π¬ Need Help? π‘ Having trouble setting it up or want to customize this workflow further? Feel free to reach out β Iβm happy to help with setup, customization, or Magento 2 API integration issues. Contact: Author π€ Author Kanaka Kishore Kandregula Certified Magento 2 Developer https://gravatar.com/kmyprojects https://www.linkedin.com/in/kanakakishore
Magento 2: auto-fix missing image alt tags with product name
This n8n workflow connects to a Magento 2 store and automatically updates product images that are missing alt tags (labels). It fetches product data via the Magento 2 REST API, identifies media gallery entries with empty or null labels, and updates them by assigning the corresponding product name as the alt text. This is useful for: Improving SEO and accessibility by ensuring all product images have descriptive alt tags. Automating manual content cleanup tasks for product catalogs. Keeping your store compliant with basic accessibility and usability standards. βοΈ How It Works Manual Trigger The workflow is designed to run manually or on a schedule (can be modified). Fetch Product Data The Get All Product Skus HTTP node pulls a paginated list of products using Magento's REST API The Split Out and Loop Over Items nodes iterate through each product. Filter Products With Images The If node checks if a product has at least one image. Label Missing Alt Texts The Code node inspects each image's label field. If it's empty or null, it sets it to the productβs name. Update Back to Magento 2 The HTTP Request (PUT) node updates each product using Magentoβs V1/products/:sku endpoint, sending the updated image labels back to the store. π§ Use Case Problem: Magento 2 stores often have hundreds or thousands of product images, and itβs common to miss assigning alt text (label) to all of themβespecially for bulk-imported or older products. Solution: This workflow ensures every product image has an alt label (minimum: product name), thus improving: Search engine optimization (SEO) Product discovery Accessibility compliance (WCAG) Store quality score (for marketplaces or audits) π§ͺ Requirements Magento 2 REST API access A valid Bearer Token for Magento 2 Magento endpoint URL Basic understanding of how your store handles image paths and media entries π Credentials Required Magento 2 Bearer Auth: Set up as a credential in n8n using your Magento 2 API access token. π οΈ Modifications You Can Make Increase the pageSize in the GET request to process more products per run. Set up a Cron trigger to run this regularly. Update other missing fields like position, disabled, or types programmatically. Include logging or email notifications after each batch update. π§° Helpful For Magento Developers & Store Managers SEO/Accessibility Compliance Teams Automation Engineers managing eCommerce workflows π Category E-commerce β Magento 2 (Adobe Commerce) π¬ Need Help? π‘ Having trouble setting it up or want to customize this workflow further? Feel free to reach out β Iβm happy to help with setup, customization, or Magento 2 API integration issues. Contact: Author π€ Author Kanaka Kishore Kandregula Certified Magento 2 Developer https://gravatar.com/kmyprojects https://www.linkedin.com/in/kanakakishore
Weekly Magento 2 stuck order reporting with Gmail & Google Sheets
Automatically identifies and reports Magento 2 orders stuck for the past 7 business days. Sends a weekly email alert to the store manager with a Google Sheets report, helping streamline order follow-ups and prevent fulfilment delays. π What It Does: This n8n automation identifies Magento 2 orders that have been stuck in the same status (like "processing") for the past 7 weekdays (excluding weekends), compiles them into a clean Google Sheet report, and emails the store manager every Monday morning with a snapshot and link to the full data for immediate action. βοΈ Technical Highlights: Automatically runs every Monday at 8 AM using the Schedule Trigger. Dynamically calculates business days only (excluding weekends) to identify stale orders. Fetches order data using Magento 2 REST API. Filters and formats key details like customer name, order value, phone, and email. Stores the data in a Google Sheet titled with the current date. Sends a professionally formatted HTML email to the manager with: A summary table of stuck orders. A button linking directly to the full Google Sheet report. β Ideal For: Magento 2 store owners/managers who need better visibility on stuck or delayed orders. Operations teams who want to avoid lost revenue or customer complaints due to order inaction. Automation engineers looking to integrate Google Workspace and Magento efficiently using n8n. π Why This Matters in the Current Market: In e-commerce, stuck orders = lost trust and lost revenue. As fulfillment expectations continue to rise, proactively managing delayed or idle orders is crucial. This workflow empowers store managers to act fast, reduce manual monitoring, and keep operations smooth β all while preserving customer satisfaction and operational reputation. π§ Modules Used: Schedule Trigger HTTP Request (Magento 2 REST API) Code (JavaScript logic for date filtering, formatting) Google Sheets (Create & Append rows) Gmail (Send custom HTML email) Set/Get Logo (optional media path fetch for branding) πΌ Use Cases: Weekly operational check-ins for stuck orders. Root cause analysis of order processing delays. Escalation trigger for order fulfillment teams. Dashboard data feed for pending revenue reports. Enhance Magento store manager awareness with automation. π Credentials Required: Magento 2 Bearer Auth (Admin API access) Google Sheets OAuth2 (Access to Google Drive & Sheets) Gmail OAuth2 (Authorized sender account) π Category: Magento 2 / E-Commerce Automation / Order Management / Reporting π¬ Need Help? If you'd like help customizing this for your Magento store, such as: Filtering by specific order statuses Adding Slack/Telegram alerts Multi-store/multi-manager support Feel free to reach out β we can assist in tailoring the workflow to your unique business logic. Contact: Author π€ Author Kanaka Kishore Kandregula Certified Magento 2 Developer https://gravatar.com/kmyprojects https://www.linkedin.com/in/kanakakishore