Gatemi Order Export Developer Reference

The free edition applies no filters of its own and stores nothing. Everything below is the full edition.

Filters

Filter Arguments Use
gmoe_columns array $columns The column catalog. Add your own columns here.
gmoe_query_args array $args, array $filters The arguments passed to wc_get_orders() for each batch of 200.
gmoe_row array $row, WC_Order $order, ?WC_Order_Item $item One row's values, in column order, before it is written. $item is the line for a per-line row, otherwise null.
gmoe_settings array $settings default_columns and capability.
gmoe_modules array $modules The ordered module list.
gmoe_license_api_url string $url The gatemi.com licensing endpoint.
gmoe_update_cache_ttl int $seconds How long update information is cached.
Action Arguments When
gmoe_booted Container $container After every module has booted.
gmoe_scheduled_exports — The daily cron event that sends scheduled profiles.

Adding a column

A column is an entry in the catalog, keyed by a unique id:

add_filter( 'gmoe_columns', function ( $columns ) {
	$columns['vat_number'] = array(
		'label' => 'VAT number',
		'group' => 'billing',          // order | billing | shipping | items
		'value' => static function ( $order ) {
			return (string) $order->get_meta( '_billing_vat_number' );
		},
	);
	return $columns;
} );

A per-line column sets per_item to true and receives the line as its second argument:

add_filter( 'gmoe_columns', function ( $columns ) {
	$columns['item_weight'] = array(
		'label'    => 'Item weight',
		'group'    => 'items',
		'per_item' => true,
		'value'    => static function ( $order, $item ) {
			$product = $item ? $item->get_product() : null;
			return $product ? (string) $product->get_weight() : '';
		},
	);
	return $columns;
} );

Give every column a label and a value. group is optional (a column without one is listed under Order) and per_item is optional (off unless set to true); missing keys are filled with the catalog's defaults, and an entry that is not an array is dropped. The value callback must return a scalar; anything else is written as an empty cell. Your column appears in the picker in its group, can be saved in profiles, and goes through the same CSV-injection guard as every other cell.

Changing the query

Export only orders paid by card:

add_filter( 'gmoe_query_args', function ( $args, $filters ) {
	$args['payment_method'] = 'gmstripe_card';
	return $args;
}, 10, 2 );

Keep limit, paged and paginate as they are: the exporter pages through the results itself and stops at the first empty page.

Changing a row

add_filter( 'gmoe_row', function ( $row, $order, $item ) {
	return array_map( 'strtoupper', $row );
}, 10, 3 );

Data

Name Type Contents
gmoe_settings Option default_columns (array of keys), capability (default manage_woocommerce).
gmoe_profiles Option Saved profiles, keyed by id.
gmoe_license Option Licence state.
gmoe_update_payload Transient Cached update information.
gmoe_scheduled_exports Cron hook Daily, only while a scheduled profile exists.
gmoe_license_check Cron hook Licence check, only while a key is entered.
wp-content/uploads/gmoe-exports/ Folder Temporary files for scheduled exports, deleted after each email.

The profile shape

'monday-shipping-list' => array(
	'id'       => 'monday-shipping-list',
	'name'     => 'Monday shipping list',
	'columns'  => array( 'order_number', 'shipping_name', 'item_sku' ),
	'filters'  => array(
		'statuses'   => array( 'processing' ),
		'date_from'  => '',           // Y-m-d or empty; a download only — a scheduled run covers yesterday or last week
		'date_to'    => '',
		'product_id' => 0,
	),
	'schedule' => 'weekly',           // '' | daily | weekly
	'email'    => 'warehouse@example.com', // empty: the store's admin address
),

The id is made from the name with sanitize_title(), with -2, -3… added when it is taken.

Constants

The full edition defines GMOE_VERSION, GMOE_PLUGIN_FILE, GMOE_PLUGIN_DIR, GMOE_PLUGIN_URL and GMOE_BASENAME. The free edition stands down when GMOE_VERSION is defined.

Shopping Cart
Scroll to Top