1. Opening Problem Statement
Meet Julia, the marketing manager for a fast-growing online boutique selling handcrafted jewelry through Shopify. Every Monday morning, Julia used to spend at least two hours manually logging into Shopify, exporting weekly sales data, calculating total orders and revenue, then compiling it into a report to share with her team on Slack and into Google Sheets for record keeping. This repetitive task often delayed timely insights and was prone to errors like missing orders or incorrectly summed revenues, leading to costly misinterpretations in sales performance.
Julia wondered if there was a better way to automate this weekly reporting process, one that could save her time, ensure accuracy, and instantly notify her team without manual effort.
2. What This Automation Does
This n8n workflow is designed to automate Shopify weekly sales reporting by combining data extraction, transformation, and communication steps seamlessly.
When run, it will:
- Trigger every week at 10 AM automatically using the Cron node.
- Fetch all Shopify orders from the store using the Shopify node.
- Extract and transform order dates for filtering with the Date & Time node.
- Filter orders based on date using the IF node to ensure relevant weekly data.
- Calculate total number of orders and total revenue dynamically with a Function node running JavaScript.
- Send a formatted summary message to a specific Slack channel with the Slack node, instantly informing the team.
- Append detailed sales data to a Google Sheet document with the Google Sheets node for record keeping.
By automating these six steps, Julia saves over 8 hours monthly, eliminates data entry errors, and ensures her whole team is always updated every week without lifting a finger.
3. Prerequisites ⚙️
- An active Shopify store with API access enabled. 🔑
- A configured Google Sheets account with OAuth2 credentials set up in n8n to allow appending data. 📊
- A Slack workspace with an API token and a designated channel where sales updates will be posted. 💬
- An n8n account, either cloud-hosted or self-hosted through services like Hostinger. 🔐
4. Step-by-Step Guide to Build This Workflow
Step 1: Set Up a Weekly Trigger Using Cron Node
Navigate to the n8n editor, drag and drop the Cron node from the nodes panel. Set the trigger to “Every Week” and specify the hour as 10 to run at 10 AM every week. This will automate your workflow without manual starts.
Visual: The Cron node displays “Trigger every week at 10:00”.
Common Mistake: Forgetting to configure the timezone or setting the schedule incorrectly might cause the workflow to trigger off-hours.
Step 2: Connect Shopify Node to Fetch All Orders
Add the Shopify node and connect it to the Cron node’s output. Choose the operation “Get All” to fetch all orders from your store. Ensure your Shopify API credentials are correctly configured and linked.
Visual: The node should show “Operation: getAll”.
Common Mistake: Invalid or expired Shopify API credentials will cause authentication errors.
Step 3: Extract Order Dates with the Date & Time Node
Next, the Date & Time node converts the order’s created_at field into a standardized datetime format, stored as order_date. Connect Shopify node’s output to this node.
Code snippet: In the node, set the value to {{$json["created_at"]}} to pull order creation times correctly.
Expected outcome: Each order now has a parsed date field for filtering.
Common Mistake: Using incorrect field names will result in empty date values and break date filtering.
Step 4: Filter Orders by Date Using IF Node
Insert the IF node after the Date & Time node to filter orders as needed. For instance, you can filter orders created after a specific timestamp. Use conditions comparing the order_date property.
Example: Check if order_date is after 2021-08-17T15:00:53.223Z.
Expected Outcome: Orders will be partitioned into “true” and “false” branches for further processing.
Common Mistake: Mismatch in date format or timezone can lead to incorrect filtering.
Step 5: Assign Individual Order Prices with Set Node
Use the Set price node to extract and set each order’s total price into a unified field called orderPrice. This simplifies calculations downstream.
Configure the node to keep only the orderPrice field with value {{$json["total_price"]}}.
Expected Outcome: Each order item now contains a numeric orderPrice for summing.
Common Mistake: Forgetting to keep only set removes other necessary fields.
Step 6: Calculate Totals with Function Node
Add a Function node that receives all filtered orders. Use the below JavaScript code to calculate total orders and sum total revenue.
let totalOrders = items.length;
let ordersSum = 0;
for(let i=0; i < items.length; i++) {
ordersSum += parseFloat(items[i].json.orderPrice);
}
return [{json:{totalOrders, ordersSum}}];
Explanation: Iterates over each order, accumulates the prices and counts orders.
Expected Outcome: Produces a summary JSON object with totalOrders and ordersSum.
Common Mistake: Failing to parse price as float may cause NaN errors.
Step 7: Notify Team via Slack Node
Attach a Slack node to send a weekly sales summary message. Use the template text: Hey team, this week we had {{$json["totalOrders"]}} orders with a total value of € {{$json["ordersSum"]}}.
Select your Shopify sales channel (e.g., "shopify") as the message destination.
Expected Outcome: Your team receives an immediate notification in Slack.
Common Mistake: Missing or invalid Slack API token will prevent messages from sending.
Step 8: Append Data to Google Sheets For Record Keeping
Finally, add a Google Sheets node to append this summary data to a spreadsheet. Choose "Append" operation and specify the correct Sheet ID.
Ensure OAuth2 authentication is properly set up.
Expected Outcome: Data logs weekly sales summaries in your spreadsheet automatically.
Common Mistake: Incorrect Sheet ID or insufficient permissions cause failures.
5. Customizations ✏️
- Change Reporting Time: In the Cron node, adjust the hour field to trigger reports at your preferred time instead of 10 AM.
- Filter Orders for Specific Product: Modify the IF node to filter orders including a particular product ID inside the order JSON.
- Change Slack Channel: In the Slack node, update the channel field to any Slack channel of choice to target different teams.
- Expand Google Sheets Logging: Add more fields like order date, customer name by modifying the Google Sheets node and mapping additional data.
- Include Refunds or Discounts: Adjust the Function node to subtract refunds or add discounts from the total sums for accuracy.
6. Troubleshooting 🔧
Problem: "Invalid Shopify API credentials"
Cause: Credentials are expired, revoked, or incorrectly configured.
Solution: Go to n8n settings → Credentials → Shopify, and re-authenticate or update API keys.
Problem: "Slack message fails to send"
Cause: API token missing or channel name incorrect.
Solution: Verify Slack credentials in n8n and confirm the channel name exactly matches Slack's channel.
Problem: "Google Sheets authentication error"
Cause: OAuth2 token expired or insufficient Sheet permissions.
Solution: Refresh OAuth2 credentials in n8n and check sharing permissions for the Sheet.
7. Pre-Production Checklist ✅
- Double-check all API credentials for Shopify, Slack, and Google Sheets are configured and active.
- Test the Cron schedule matches your local timezone and preferred report time.
- Confirm that the IF node filters orders correctly by testing with sample dates.
- Run the Function node independently with sample order prices to verify calculations.
- Test sending a manual Slack message and appending one row in Google Sheets before deployment.
8. Deployment Guide
Activate your workflow by turning it on in n8n. Monitor the first few scheduled runs to ensure data accuracy and reporting.
Use n8n’s built-in executions history to review logged runs and quickly identify errors.
9. FAQs
Can I use an alternative to Slack for notifications?
Yes, you can integrate other messaging tools like Microsoft Teams or Discord by swapping the Slack node with a compatible messaging node in n8n.
Does this workflow use a lot of API credits?
It depends on your Shopify plan and API limits, but generally fetching all orders weekly and sending a Slack message uses minimal API calls.
Is my data secure when using these integrations?
n8n securely stores credentials and uses encrypted connections for all API messaging. Always keep your API keys private and rotate periodically.
Can this workflow handle large order volumes?
Yes, but consider pagination or batch processing in the Shopify node if you have thousands of orders. Adjust your workflow accordingly.
10. Conclusion
By building this n8n workflow, Julia has automated weekly Shopify sales reporting — saving over 8 hours every month. She now accurately tracks orders and revenue and instantly informs her team through Slack, while preserving historical data in Google Sheets.
Next, Julia could extend this by adding automated alerts for low stock, incorporating customer feedback surveys, or generating monthly financial reports. With n8n, these automation possibilities are within your reach too. Happy automating!