If you’re using CSV exports for passing data to 3rd parties, for example fulfilment companies, you often need to provide fields in the CSV that don’t exist in WP e-Commerce – for example your account number, or pickup address.

The dashboard plugin contains filters that allow you to define your own columns, and to specify a function to be called to generate the data for that column.

As an example, we’ll define a new column Carrier Account Number, and populate it with a fixed value AC12345.

The first step is to register a new field – here’s the code:

You can register as many fields as you want inside the function – just add them all to the $fields array before returning it. Here – we’re just registering a single field.

The important sections are as follows:

Title
This is what will be shown on the field selection screens, and on the header row.
ShowOn
This controls whether the field is available on Order exports (‘Orders’), Order line exports (‘Lines’), or all exports (‘Both’)
QueryID
This specifies how the data for the field show be generated. Here we’re just indicating that the export generator should call the function output_account_number_in_exports

Then all we have to do is specify our function:

Once that’s done – your fields will show up on the field selection screen for standard, and scheduled exports, and you custom function will be called to output the data for each row on the export.


This entry was posted in .
Bookmark the permalink.