Search Documentation

Code snippets allow you to override the default behavior of Store Exporter Deluxe by hooking into the Plugin code.

Add a custom User field to the Orders export type

To add a custom User field that uses the User ID linked to individual Orders within the Orders export type add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Add a single Order export field with all Billing or Shipping address details

To add a single custom Order field that collates all of the Billing or Shipping address details add the following PHP snippets to your current WordPress Theme’s functions.php file. Note: If you are applying both PHP snippets use different PHP function names, if you need help reach out on Support. Billing address fields View Code Shipping address fields View Code

Adding a custom Last Modified field to the Orders export type

To add a custom Last Modified Order field within the Orders export type add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding a custom Order filter to the Edit Scheduled Export screen

To add a new custom Order Filter to the Edit Scheduled Export screen add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding a custom Order filter to the Orders export type

You can add your own Order filters (e.g. Filter Orders by Shipping Postcode) the Orders export by hooking into our exposed WordPress Actions and Filters. To add a custom Order filter to the Order export type in Store Exporter Deluxe add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding a custom Product filter to the Edit Scheduled Export screen

To add a new custom Product Filter to the Edit Scheduled Export screen add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding a custom Subscription field to the Subscriptions export type

To add a custom Subscription field within the Subscriptions export type add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding a Custom Term Taxonomy-linked export field to the Products export type

To add a new Custom Term Taxonomy-linked export field to the Products export type in Store Exporter Deluxe add the following PHP snippet to your current WordPress Theme’s functions.php file replacing $term_taxonomy with the Custom Term Taxonomy name of your choosing: View Code Here's a extended example of adding multiple Custom Term Taxonomy-linked export fields to the Products export type from different Custom Term Taxonomies (that's a mouthful): View Code

Adding a custom Term Taxonomy-linked export field to the Users export type

To add a new Custom Term Taxonomy-linked export field to the Users export type in Store Exporter Deluxe add the following PHP snippet to your current WordPress Theme’s functions.php file replacing $term_taxonomy with the Custom Term Taxonomy name of your choosing: 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

Adding static Order fields to the Orders export type

Our Store Exporter DeluxeUsage document explains how to add custom export fields to the Product export type, this same technique can add custom export fields to other export types except Orders. This tutorial will explain how to add a static export field to the Order export type. The Orders export type is made up of two types of export fields:
  1. Order fields - Export fields related to the Order
  2. Order Item fields - Export fields related to the Order Items that make up an Order
This tutorial will not cover adding static Order Item fields or dynamic Order fields (e.g. accessing, Terms, Posts or the WordPress database to retrieve a value), see Adding static Order Item fields to the Orders export type which covers this. A future tutorial will cover dynamic Order fields.

Adding a single static Order field

To add a new static Order field add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding multiple static Order fields

To add multiple static Order fields add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding static Order Item fields to the Orders export type

Following up from our last Store Exporter Deluxe snippet about Adding static Order fields to the Orders export type we will add a static Order Item field to the Orders export type. The 3 different Order Items Formatting rules (combined, individual and unique) require different WordPress Filters to be accessed in order to correctly format the export. We will cover each Order Items Formatting option separately; starting with the simplest. First let's add the static Order Item field to the Order fields list before looking at each Order Items Formatting rule. View Code

Place Order Items within a grouped single Order row (combined)

Add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Place each Order Item within their own Order row (individual)

Add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Place Order Items on individual cells within a single Order row (unique)

Add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Adding static Product fields to the Product export type

To add a new static Product field to the Products export type in Store Exporter Deluxe add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Allow partial Order refunds to populate the Refund Date column in Order exports

By default the Refund Date column within the Order export type is only populated on fully refunded Orders, to override this behaviour to include any partial Order refund add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Change the default WooCommerce currency delimiter and thousand separator in exports

By default export columns that contains currencies are formatted using the WooCommerce currency settings, to override this behaviour add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Changing the e-mail subject and content of Scheduled Exports

By default, Store Exporter Deluxe includes the following e-mail subject and content text in Scheduled Exports making use of the "Send as e-mail" Export method. Subject: Daily Product stock levels Content: Please find attached your export ready to review. The e-mail subject can be edited within the Edit Scheduled Export screen but to modify the Content element you'll need to hook into our exposed WordPress Filter. I have made a task to include a text field on the Edit Scheduled Export > Method tab to edit this content just like the e-mail subject field above. Add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Creating a custom WordPress Plugin to extend Store Exporter Deluxe

This tutorial will show you how to create a custom WordPress Plugin that extends the Store Exporter Deluxe Plugin without making changes to your Theme or Child Theme's functions.php file. This solution is strongly recommended where a Child Theme is not in use. The action within this tutorial removes the first part of the Order Items: Product Name export column's contents where this store has setup their Product Name to have a '/' (forward slash) to separate Product Name details (e.g. Store Exporter Deluxe / WooCommerce where only Store Exporter Deluxe is required). You can replace the action within this Custom Add-on Plugin with any Code Snippet available on this website.

The code snippet

View Code

General instructions

Here's how we do it:
  1. Connect to your WordPress site using your preferred FTP/SFTP manager
  2. Navigate to the /wp-content/plugins/... directory
  3. Create a new directory named 'woocommerce-store-exporter-deluxe-custom'
  4. Open the 'woocommerce-store-exporter-deluxe-custom' directory
  5. Create a new file named 'custom.php'
  6. Edit the 'custom.php' file with your preferred file editor
  7. Paste the contents of the code snippet at the top of this tutorial
  8. Save the modified file and upload the file changes
  9. Open the WordPress Administration of your WordPress site
  10. Open the Plugins screen from the Plugins sidebar menu
  11. Scroll down to 'WooCommerce - Store Exporter Deluxe (Custom Add-on)'
  12. Click Activate to activate this custom Plugin add-on
That's it! The code snippet placed within the custom Plugin add-on will now be active and applied to future exports; give it a try! You can add/remove code snippets from this file whenever you like! 🙂

Disable Product Attributes support within Store Exporter Deluxe

You can disable Product Attributes support within Store Exporter Deluxe when diagnosing export issues related to PHP form field limitations. Add the following PHP snippets to your current WordPress Theme’s functions.php file to disable Product Attributes support within Store Exporter Deluxe. This will hide all export fields across all Export Types related to Product Attributes and is handy in store's with a large volume of Global Attributes. View Code

Embed Featured Image thumbnails in Product exports

There's an easter egg in Store Exporter Deluxe that only select beta testers have known about. It's come time to share this new Product export field with the community as it's received very positive feedback since it's quiet introduction and will be listed as "Featured Image (Embed)" in the 2.1.2 minor Plugin update due this fortnight. Include embedded Featured Image Product thumbnails within XLSX exports by adding the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Export all field data in uppercase characters

To force all export data to be in uppercase characters add the following PHP snippet to your current WordPress Theme’s functions.php file: 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

Include Quantity and Cost details in TM Extra Product Options columns

By default the Order export type includes the TM Extra Product Options value detail in the export column. To include the Quantity and Cost details that can also be assigned to an Order Item by TM Extra Product Options add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Modify the Order Items export to show individual Product quantity per row

To export individual Order Items per row, divided by quantity add the following PHP snippet to your current WordPress Theme’s functions.php file. View Code

Override the default %date% and %time% export filename Tags

By default Store Exporter Deluxe uses the following PHP date and time formats to populate the %date% and %time% filename Tags when generating the export filename:
  • %date% - Y_m_d
  • %time% - H_i_s
You can override Store Exporter Deluxe to use your preferred date and time formats by adding the following WordPress Filter to your WordPress Theme’s functions.php file, note you need to return the formatted date string. View Code

Override the default date format used in the %date% filename Tag

To override the default date format used in the %date% Tag of export filenames (default is: Y_m_d: 2017_01_22) add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Override the default order_items XML node in exports

By default all XML Order exports include a order_items node that contains that Order's Order Items. You can override this to suit your store needs by adding the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Override the default Post Status data that is included in exports

By default Store Exporter Deluxe formats the Post Status included in exports to have the first letter capitalised (e.g. Publish, Draft, etc.). Where you need greater control over the Post Status data you can extend the Post Status data by hooking in our exposed WordPress Filters. In the below example we replace 'Publish' with 'p' and 'Draft' with 'd' in Store Exporter Deluxe. Add the following PHP snippets to your current WordPress Theme’s functions.php file: View Code

Override the default Product Brand Term Taxonomy detection in Store Exporter Deluxe

Out of the box Store Exporter Deluxe detects the WooCommerce Brands AddonWooCommerce Brands Plugin or 'product_brand' Term Taxonomy slug and unlocks the Brands export type and Brand filters. Where we get stuck is detecting the Brands export type within WordPress Theme's that do not make use of the WordPress standard 'product_brand' Term Taxonomy slug. You can override the default Term Taxonomy that we check for Product Brands by adding the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Override the default store XML node in exports

By default all XML exports include an opening node called store. You can override this to suit your store needs by adding the following PHP snippet to your current WordPress 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.

Override the default time format used in the %time% filename Tag

To override the default time format used in the %time% Tag of export filenames (default is: H_i_s: 12_17_53) add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code  

Override the default ZipArchive Class in PHPExcel for XLS and XLSX exports

By default Store Exporter Deluxe uses the ZipArchive Class for generating the OfficeOpenXML file format required by the XLS and XLSX file types. Where the ZipArchive Class is unavailable - not installed or disabled - you can override Store Exporter Deluxe to use an alternate Class called PCLZip by adding the following WordPress Filter to your WordPress Theme's functions.php file. View Code

Overriding WooCommerce currency defaults in exports

You can override the default WooCommerce currency options in exports generated by Store Exporter Deluxe. Add one of the following PHP snippets to your current WordPress Theme's functions.php file: Override the decimal separator View Code Override the thousand separator View Code

Remove Shortcodes and Visual Composer markup from the Product Description field

As a follow up to Strip Shortcodes and Visual Composer markup from the Order Items: Description export field, here's how to strip Shortcodes and Visual Composer markup from the Description export field within Product exports. Add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Return the highest Variation Price as Variable Price in Product exports

By default Store Exporter Deluxe detects if a Variable Product contains Variations with different minimum and maximum Prices (e.g. 25.00-30.00), where this happens we show the minimum and maximum Variation Price separated by a dash. This can be overridden to only show the minimum Variation Price as explained in the last post or in this case the maximum Variation Price by adding the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Return the lowest Variation Price as Variable Price in Product exports

By default Store Exporter Deluxe detects if a Variable Product contains Variations with different minimum and maximum Prices (e.g. 25.00-30.00), where this happens we show the minimum and maximum Variation Price separated by a dash. This can be overridden to only show the minimum Variation Price by adding the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

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

Strip Shortcodes and Visual Composer markup from the Order Items: Description export field

To remove Shortcodes and Visual Composer markup from the Order Items: Description export field within Order exports add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Switch to alternate PHPExcel caching methods for large exports

For large store exports it may be necessary to change the default memory caching method used within PHPExcel based exports (e.g. CSV, TSV, XLS, XLSX export types), add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Switching between ftp_put and ftp_fput FTP upload methods in Store Exporter Deluxe

By default, Store Exporter Deluxe uses the ftp_put() PHP function to upload an export file to the FTP server, a WordPress Filter within Store Exporter Deluxe has been exposed so you can change this to the ftp_fput() PHP function so that our Plugin uploads from an open file to the FTP server. Add the following PHP snippet to your current WordPress Theme's functions.php file: View Code

Trigger e-mail notification on failed Scheduled Exports

Since the 2.1.6 Plugin release of Store Exporter Deluxe it is possible to hook into the WordPress Action 'woo_ce_failed_scheduled_export' which is run when a Scheduled Export fails to complete successfully (e.g. login issue, unable to write file, empty export, etc.). To generate an e-mail notification on failed Scheduled Exports add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code

Turning off save prompt on Edit Scheduled Export screen

By default Store Exporter Deluxe displays a modal prompt when clicking the Return to Settings button on the Edit Scheduled Export screen, this can be disabled by adding the following PHP snippet to your current WordPress Theme's functions.php file: View Code

Turning off save prompt on Field Editor screen

By default Store Exporter Deluxe displays a modal prompt when clicking the Return to Quick Export button on the Field Editor screen, this can be disabled by adding the following PHP snippet to your current WordPress Theme's functions.php file: View Code

Use the Variation Name instead of Slug within the Product Name detail of Product exports

Update: The rule is if 3 different users ask for the same PHP snippet that I put it up here on the Blog. I've been doing a few snippet Posts this quarter so will turn off automatic e-mail notifications for PHP snippets after this one so not to spam registered users. You can improve the readability of the Product exports Product Name column when exporting Variations by switching from using the default Attribute slug to the Attribute title. An example of this change is below: Default Product Name (Slug): Forma Linea Strom - Size: platos-80-90cm-x-eos-200cm-mikos Customised Product Name (Title/Term Name): Forma Linea Strom - Size: Platos 80-90cm x EOS 200cm Mikos Note: Product Importer Deluxe requires the Product Name detail to use the default Attribute slug format for generating Variations, this snippet is targeted to export users. Add the following PHP snippet to your current WordPress Theme’s functions.php file: View Code