WooCommerce Ecommerce Social Media Automation - n8n Workflow

WooCommerce Ecommerce Social Media FB Insta Automation

Complete n8n Workflow Template for Daily Social Media Posts

Download Complete Workflow
WooCommerce Ecommerce Social Media Automation - n8n Workflow by MetaTager

Workflow Overview

This workflow automates the entire process of generating and scheduling social media posts from your WooCommerce store:

  • Daily Trigger: Runs automatically every 24 hours
  • Product Selection: Fetches 3 random products daily
  • Category Selection: Fetches 3 random categories daily
  • Content Generation: Creates 3 unique posts per product/category
  • Scheduling: Distributes posts throughout optimal posting times
  • Multi-Platform: Publishes to Facebook and Instagram
18
Posts Per Day
9
Product Posts Daily
9
Category Posts Daily
2
Platforms (FB & IG)

Prerequisites & Setup

WooCommerce API

Enable REST API in WooCommerce → Settings → Advanced → REST API

Generate Consumer Key & Secret with read permissions

Facebook Business

Facebook Business Account with Page access

Instagram Business Account connected to Facebook

API tokens with publish permissions

n8n Setup

n8n installed (self-hosted or cloud)

Required nodes: WooCommerce, Facebook Graph API

Google Sheets node for logging (optional)

1 Install Required n8n Nodes
npm install n8n-nodes-woocommerce npm install @n8n/n8n-nodes-langchain # Optional for AI content
2 Configure WooCommerce API Credentials
{ "name": "WooCommerce Store", "type": "woocommerceApi", "data": { "url": "https://yourstore.com", "consumerKey": "ck_your_key_here", "consumerSecret": "cs_your_secret_here" } }

Workflow JSON Template

3 Copy Complete Workflow JSON

Copy the entire JSON below and import it into your n8n instance:

This workflow is designed to generate 18 posts daily (9 products + 9 categories) distributed across Facebook and Instagram.
{ "name": "WooCommerce Daily Social Media Automation", "nodes": [ { "name": "Daily Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [250, 300], "parameters": { "rule": { "interval": [{ "field": "days", "minutesInterval": 1440 }] } } }, { "name": "WooCommerce Config", "type": "n8n-nodes-base.woocommerce", "position": [450, 300], "parameters": { "authentication": "genericCredentialType", "url": "={{$credentials.woocommerce.url}}", "consumerKey": "={{$credentials.woocommerce.consumerKey}}", "consumerSecret": "={{$credentials.woocommerce.consumerSecret}}" } }, { "name": "Get 3 Random Products", "type": "n8n-nodes-base.woocommerce", "position": [650, 200], "parameters": { "resource": "product", "operation": "getAll", "limit": 100, "additionalFields": { "orderby": "rand", "status": "publish" } } }, { "name": "Get 3 Random Categories", "type": "n8n-nodes-base.woocommerce", "position": [650, 400], "parameters": { "resource": "category", "operation": "getAll", "limit": 100, "additionalFields": { "orderby": "rand", "hide_empty": true } } }, { "name": "Generate Product Posts", "type": "n8n-nodes-base.code", "position": [850, 200], "parameters": { "language": "javaScript", "code": "const product = items[0].json;\nconst posts = [\n {\n platform: 'facebook',\n content: `NEW ARRIVAL! Check out our ${product.name}!\\n\\nPrice: $${product.price}\\n\\nShop now: ${product.permalink}\\n\\n#woocommerce #onlineshopping`,\n type: 'photo',\n media_url: product.images ? product.images[0]?.src : null\n },\n {\n platform: 'instagram',\n content: `${product.name} just dropped!\\n\\nSwipe up to shop\\n\\n$${product.price}\\n\\n#shoplocal #onlineshopping #woocommerce`,\n type: 'photo',\n media_url: product.images ? product.images[0]?.src : null\n },\n {\n platform: 'facebook',\n content: `HOT DEAL ALERT!\\n\\nLove ${product.name}? Here's why customers rave about it:\\n\\nHigh quality\\nGreat value\\nExcellent reviews\\n\\nGet yours today!\\n\\n${product.permalink}\\n\\n#dealoftheday #shopping`,\n type: 'photo',\n media_url: product.images ? product.images[1]?.src : product.images[0]?.src\n }\n];\nreturn posts.map(post => ({ json: { ...post, product_id: product.id } }));" } }, { "name": "Generate Category Posts", "type": "n8n-nodes-base.code", "position": [850, 400], "parameters": { "language": "javaScript", "code": "const category = items[0].json;\nconst posts = [\n {\n platform: 'facebook',\n content: `BROWSE OUR ${category.name.toUpperCase()} COLLECTION!\\n\\nDiscover amazing products in our ${category.name} category.\\n\\nView collection: ${category.link}\\n\\n#${category.name.replace(/\\\\s+/g, '')} #shopping`,\n type: 'photo',\n media_url: category.image ? category.image.src : null\n },\n {\n platform: 'instagram',\n content: `Explore our ${category.name}\\n\\nCurated collection just for you!\\n\\nTap link in bio\\n\\n#${category.name.replace(/\\\\s+/g, '')} #shop #instagram`,\n type: 'carousel',\n media_url: category.image ? category.image.src : null\n },\n {\n platform: 'facebook',\n content: `LOOKING FOR ${category.name.toUpperCase()}?\\n\\nWe've got the best selection!\\n\\nWide variety\\nCompetitive prices\\nFast shipping\\n\\nBrowse now: ${category.link}\\n\\n#${category.name.replace(/\\\\s+/g, '')} #onlineshop`,\n type: 'photo',\n media_url: category.image ? category.image.src : null\n }\n];\nreturn posts.map(post => ({ json: { ...post, category_id: category.id } }));" } }, { "name": "Schedule Posts", "type": "n8n-nodes-base.code", "position": [1050, 300], "parameters": { "language": "javaScript", "code": "const allPosts = items.flatMap(item => item.json);\nconst startHour = 9;\nconst endHour = 21;\nconst scheduledPosts = allPosts.map((post, index) => {\n const postTime = new Date();\n const timeInterval = (endHour - startHour) * 60 / allPosts.length;\n postTime.setHours(startHour);\n postTime.setMinutes(Math.floor(index * timeInterval));\n postTime.setSeconds(0);\n if (postTime < new Date()) {\n postTime.setDate(postTime.getDate() + 1);\n }\n return {\n json: {\n ...post,\n scheduled_time: postTime.toISOString(),\n scheduled_time_readable: postTime.toLocaleString()\n }\n };\n});\nreturn scheduledPosts;" } }, { "name": "Facebook Publisher", "type": "n8n-nodes-base.facebookGraphApi", "position": [1250, 200], "parameters": { "resource": "post", "operation": "create", "pageId": "={{$credentials.facebook.pageId}}", "message": "={{$json.content}}", "additionalFields": { "scheduled_publish_time": "={{new Date($json.scheduled_time).getTime() / 1000}}" } } }, { "name": "Instagram Publisher", "type": "n8n-nodes-base.instagramGraphApi", "position": [1250, 400], "parameters": { "resource": "media", "operation": "create", "mediaType": "={{$json.type}}", "imageUrl": "={{$json.media_url}}", "caption": "={{$json.content}}" } }, { "name": "Success Notification", "type": "n8n-nodes-base.emailSend", "position": [1450, 300], "parameters": { "subject": "Social Media Posts Scheduled Successfully", "text": "={{`Successfully scheduled ${$input.all().length} posts.`}}" } } ], "connections": { "Daily Trigger": { "main": [[{"node": "WooCommerce Config", "index": 0}]] }, "WooCommerce Config": { "main": [[{"node": "Get 3 Random Products", "index": 0}], [{"node": "Get 3 Random Categories", "index": 1}]] }, "Get 3 Random Products": { "main": [[{"node": "Generate Product Posts", "index": 0}]] }, "Get 3 Random Categories": { "main": [[{"node": "Generate Category Posts", "index": 0}]] }, "Generate Product Posts": { "main": [[{"node": "Schedule Posts", "index": 0}]] }, "Generate Category Posts": { "main": [[{"node": "Schedule Posts", "index": 1}]] }, "Schedule Posts": { "main": [[{"node": "Facebook Publisher", "index": 0, "condition": {"type": "if", "conditions": [{"leftValue": "={{$json.platform}}", "operator": "equal", "rightValue": "facebook"}]}}], [{"node": "Instagram Publisher", "index": 1, "condition": {"type": "if", "conditions": [{"leftValue": "={{$json.platform}}", "operator": "equal", "rightValue": "instagram"}]}}]] }, "Facebook Publisher": { "main": [[{"node": "Success Notification", "index": 0}]] }, "Instagram Publisher": { "main": [[{"node": "Success Notification", "index": 1}]] } } }

Workflow Features

Automated Daily Execution

Runs automatically every 24 hours to fetch new products/categories

Random selection ensures content variety

Smart Content Generation

Platform-specific content (Facebook vs Instagram)

Automated hashtag generation from product/category names

Image handling with fallback logic

Intelligent Scheduling

Posts distributed throughout optimal hours (9 AM - 9 PM)

Automatic timezone handling

Future scheduling if current day's slots are full

Download Complete Workflow

Click below to download the complete n8n workflow JSON file:

Download WooCommerce Workflow.json

File: woocommerce-social-media-automation.json

Contact form