Advanced Order Export for WooCommerce

Export Products as columns

Use the standard export when you need a detailed, line‑item breakdown of each order (multiple rows per order). But use Products as Columns additional code when you need:

Use Case

Benefit

Comparing product quantities across orders

Each order occupies exactly one row, making it easy to scan

Feeding data into a pivot table

The layout is ready for immediate analysis in Excel

Creating product‑popularity or SKU‑level reports

Quickly see which products appear most frequently across orders

This mode is ideal for analysts, inventory planners, and marketing teams who need to evaluate product performance without wading through per‑line‑item detail.

Note: These codes should be added via Code Snippets plugin (otherwise put it to the functions.php of your current theme). Users of the PRO version should set mode “Run snippet everywhere” in the snippet if they use the scheduled jobs!


How the Code Works (Developer Overview)

The code is a self‑contained PHP class that hooks into the plugin’s internal events. Here is what each section does:

Section

Purpose

woe_settings_above_buttons

Adds the “Export products as columns” checkbox to the export profile UI.

woe_settings_validate_defaults

Disables the standard product items export and reads the chosen output field (Quantity / Line Total).

woe_xls_header_filter

Prepares internal storage for dynamic column discovery.

woe_order_export_started

Captures the current order ID as the export progresses.

woe_xls_output_filter

Aggregates product data for each order and builds the per‑row cell values.

woe_xls_print_footer

Writes product names as column headers, adds the total row, and applies bold formatting to the header row.

The code also respects the “Export all products from the order” setting in your export profile. If this setting is disabled, only products that match your current filters will appear as columns.


Customising the Output

The code is designed to be modified. Here are common customisation scenarios:

Change the Aggregated Value

By default, you choose between Qty and Amount in the UI. To use a different field (e.g., line_subtotal or line_total_plus_tax), locate this line in the code:

php

$this->output_field = $current_job_settings['products_as_columns_output_field'];

Replace the right‑hand side with your desired field key, or modify the UI generation to provide additional options.

Exclude Certain Products

The code respects the standard product filters. To manually exclude products, add a condition inside the foreach($order->get_items('line_item') loop. For example, to skip products with a specific SKU:

if ( $item->get_sku() === 'HIDDEN-SKU' ) continue;

Change the Cell Data (Beyond Simple Quantity)

To display something more complex than a number (e.g., a concatenation of product attributes), replace:

$extra_cells[] = $item[ $this->output_field ];

with your own logic. You can access the WC_Order_Item object via $item and the full WC_Productobject via $item->get_product().

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