Show a unique Order Item row matching the Quantity value for each Order Item

By default the Order Items Formatting rule “Place each Order Item within their own Order row” places each unique Order Item on its own row. This PHP snippet will force a new Order Item row for each quantity of an Order Item which is ideal for grocers and bulk Orders, for instance:

An Order of 3 Big Apples and 6 Small Apples will generate 9 Order Item rows with a Order Item: Quantity of 1 applied to all Order Items.

View Code

Adding custom Order Item fields to the Order export type

This code snippet builds on Adding static Order Item fields to the Orders export type, now we will add a dynamic custom Order Item field to the Order export type. The custom Order Item meta that we want to export is saved against the Order Item with a meta name of “departure_date”. You can use Store Toolkit for WooCommerce to easily expose custom Order and Order Item meta assigned to Orders.

Note: You need to declare each of the different Order Items Formatting rules with the “unique” Order Items Formatting rule being the most complex, if you don’t use the “unique” rule then it can be ignored for simplicity.

View Code

Flush the Extra Product Options export fields Transient in Store Exporter Deluxe

By default Store Exporter Deluxe refreshes it’s list of known Extra Product Option (EPO) export fields hourly, you can force refresh this on demand by clicking “Refresh counts” from the Export Types section on the Quick Export screen but you may wish to do this programmatically. The following PHP snippet will clear the Transient and on the next screen refresh of the Quick Export screen this list will be re-generated.

Add the following PHP snippet to your Child Theme’s functions.php file:

View Code

Override the default temp directory used for exports in Store Exporter Deluxe

By default Store Exporter Deluxe uses the PHP temp directory for generating export files but on some misconfigured WordPress sites the ‘temp’ directory needs to be adjusted (e.g. where the open_basedir restriction is in effect but a valid tmp path has not been set).

The exposed WordPress Filter woo_ce_sys_get_temp_dir allows us to override the default temp directory used by Store Exporter Deluxe for generating export files. Add the following PHP snippet to your Child Theme’s functions.php file:

View Code

The We could not create a temporary export file in … ensure that WordPress can read and write files here and try again Troubleshooting resource expands further on this issue.