The EDD Payment Export & Reports plugin allows you to export details of your customers orders to a CSV. The plugin contains support for most of the standard Easy Digital Download payment fields out of the box, as well as supporting information from well-known EDD extensions such as Software Licensing.

Sometimes however, you may have custom checkout fields that you want to export alongside the standard fields. In this case, you can alter the behaviour of the plugin to include your fields via a set of WordPress filters. These will let you register additional fields, and specify how they the output for those fields should be gathered / calculated. Simply drop these into your theme’s functions.php file or a functionality plugin, then you’ll be free to keep updating the main plugin without fear of losing your changes.

In the example below we’re going to create a “Full name” field that will simply concatenate the first, and last name of the purchases.

There are two functions you’ll need to define. The first registers the field with the plugin, making it available to choose for export. This function also tells the plugin what function it should call to generate the output for this field.

Here – we’ve defined a new field that will show up as “Customer Full Name” on the export screen, and in the heading of the column in the CSV. When the plugin generates the CSV, it will call the function lw_render_my_field() to generate the output for our field.

Our “rendering” function will be passed a $payment variable which will contain the basic information about the payment already. Here we’re picking up the first and last name, and returning them as a single string. Of course – you could load up a custom value here, and return that if you have something specific you want to grab.


This entry was posted in .
Bookmark the permalink.