Advanced Order Export for WooCommerce

Filter orders

While the UI provides robust filtering by date, status, product, customer, coupon, and payment method, some business rules require deeper customisation. This guide explores the developer hooks that allow you to modify the plugin’s order selection logic programmatically — enabling you to filter, add, or remove orders from any export run.

Overview of Order Filtering Hooks

The plugin provides three primary hooks for customising order selection:

Hook

Purpose

When It Fires

woe_order_export_started

Filter individual orders before export

After order IDs are selected, before export begins

woe_get_order_ids

Modify the complete list of order IDs

During the order selection process

woe_sql_get_order_ids_where

Inject custom SQL conditions into the WHERE clause

When building the query to fetch order IDs

These hooks are fired in sequence during any export — manual, scheduled, or status‑change triggered. By attaching custom functions to them, you gain fine‑grained control over exactly which orders appear in your export files.

Example 1: Exclude Low‑Value Orders

This example excludes any order with a total of €10 or less. Use it when your downstream system requires a minimum order value, preventing empty or trivial records from being exported.

Example 2: Skip WooCommerce Subscription Renewal Orders

If your store uses WooCommerce Subscriptions and you want to export only the original subscription orders (excluding automated renewal orders), this filter inspects the order type using the wcs_order_contains_subscription function.

Example 3: Include Order Refunds

By default, the plugin exports only shop_order post type entries. This example demonstrates how to also include shop_order_refund records, ensuring that refund transactions appear alongside their parent orders.

Example 4: Export Only Orders That Contain Customer Notes

This example appends a condition to include only orders that have non‑empty customer notes (post excerpt).

Example 5: Replace {yesterday} and {today} Placeholders

This example demonstrates how the plugin replaces {yesterday} and {today} with actual date strings.

Example 6: Replace {current_user} Placeholder

This example replaces {current_user} with the current logged‑in user’s ID, enabling user‑specific filtering.

Example 7: Additional Filters for Row‑Level Data

While not directly related to order selection, these filters allow filtering at the data‑row level and can be useful in conjunction with the order selection hooks.

woe_fetch_order_coupon – Filter Individual Coupon Rows

This filter is called for each coupon applied to an order. Returning false excludes that coupon row from the export.

Example 8: Setting a Custom Time Range

For scheduled exports that require a non‑standard date range, you can programmatically override the from_date and to_date settings. The example below sets a range from 19:00 the previous day to 12:00 today.

Example 9: Trigger Pending Order Export on Checkout

When a customer completes checkout, the order is saved with the pending status, and this code triggers the plugin’s status change export for that order.

Have questions? Please submit a support request. We're always happy to help!

Advanced Order Export
for WooCommerce
PRO

From $30
Buy
✓ 30-day money-back guarantee