Home > Docs > Import Export Suite for WooCommerce > PHP Code Editor in Advanced Export

PHP Code Editor in Advanced Export

Last updated on December 19, 2023

With the Import export suite for WooCommerce plugin, you can import and export products, product reviews, orders, coupons, subscriptions, product categories, product tags and users. In certain cases, based on the warehouse or custom data formats, we might need to change the export data format. This is attained by modifying the export data with code snippets. These code snippets are often put in the active theme’s functions.php file.

In some circumstances, you may not have access to the theme’s functions.php file editor or the theme itself does not have a functions.php file (most block-enabled themes do not have a functions.php file). In this case, you can consider adding a custom code snippet using third-party plugins. However, for our plugin, you have the option of adding the code snippet through the plugin itself to change the export data. This article describes a much simpler method for including the code snippet during the advanced export.

You can simply use the PHP code editor in the plugin to paste your code snippet. The functions will be stored in the wp-content/webtoffee_export/functions.php file and it will be applied to the data whenever an export is initiated. To begin:

  1. Install and activate the plugin.
  2. Navigate to WebToffee Import Export (Pro) > General Settings > General.
  3. Under Advanced options, enable the option PHP code editor in advanced export.
PHP code editor feature in Advanced options
PHP code editor feature in Advanced options
  1. Click on Update Settings to save the changes.
  2. Now, navigate to WebToffee Import Export (Pro) > Export.
  3. Select the post type as required.
  4. Select an export method.
  5. Filter data based on different criteria.
  6. Map and reorder export columns.
  7. On the next step, expand Advanced options, under Custom PHP code, paste the code snippet and click on Save functions to update the changes.
Custom PHP code
Custom PHP code

This will enhance the plugin’s functionality to achieve the required goal. For a more detailed explanation on how to export various post types, refer to: