boukjijtarik/woo-reports

Laravel Packageto fetch WooCommerce orders report

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/boukjijtarik/woo-reports

dev-main 2025-08-27 10:03 UTC

This package is not auto-updated.

Last update: 2026-01-01 09:46:57 UTC


README

Laravel package to fetch WooCommerce orders and items using Eloquent (no REST API), show them in a DataTable with Excel export, and auto-export if the result exceeds a threshold.

Requirements

  • PHP >= 8.1
  • Laravel 10/11/12
  • Access to the WordPress/WooCommerce database

Install

composer require boukjijtarik/woo-reports

If discovery is disabled, register Boukjijtarik\\WooSales\\WooSalesServiceProvider::class in config/app.php.

Publish config (optional):

php artisan vendor:publish --tag=woo-sales-config

Publish views (optional):

php artisan vendor:publish --tag=woo-sales-views

Configure

.env overrides:

WOO_SALES_CONNECTION=mysql
WOO_SALES_WP_PREFIX=wp_
WOO_SALES_ROUTE_PREFIX=woo-sales
WOO_SALES_DIRECT_EXPORT_THRESHOLD=1500

If the WordPress DB is separate, define a connection in config/database.php and point WOO_SALES_CONNECTION to it.

Adjust meta keys in config/woo_sales.php if needed.

Use

Open:

/woo-sales

Filters: date range, order ID, order statuses. If total rows exceed threshold, it redirects to Excel export and shows a notice. Otherwise, a DataTable is shown with an Excel button.

Direct export example:

/woo-sales/export?date_from=2024-01-01&date_to=2024-12-31&statuses[]=completed

Data model (tables)

  • {prefix}posts (orders: post_type=shop_order)
  • {prefix}postmeta (order meta)
  • {prefix}woocommerce_order_items (order items)
  • {prefix}woocommerce_order_itemmeta (item meta)
  • {prefix}terms, {prefix}term_taxonomy (product_cat), {prefix}term_relationships (product categories)

Security

Routes use web middleware. To require login, publish config and set:

'middleware' => ['web', 'auth']

License

MIT