Issues about the “Format” block
This guide is part of our Advanced Order Export Troubleshooting series. Here, we focus specifically on solving issues related to the Output (Format) block in the Advanced Order Export for WooCommerce plugin. This block is where you define the structure of your final report, and even a small misconfiguration can cause headaches.
Let’s walk through the most common problems and their solutions, one by one.
1. CSV Files: Fixing Character Encoding for International Orders
One of the most common Advanced Order Export Troubleshooting questions involves CSV files. The problem appears when a report containing European or other special characters (e.g., ñ, ü, é, ç) is opened in Excel, only to display garbled text. This is not a plugin error, but a simple encoding mismatch.
The Root Cause
The plugin defaults to UTF-8 encoding, which is the world standard. However, older versions of Microsoft Excel for Windows sometimes default to a legacy encoding like ANSI. When Excel tries to open a UTF-8 file, it misinterprets the characters.
The Solution
A special Output UTF-8 BOM checkbox is available in the CSV settings. Enabling this checkbox adds a Byte Order Mark (BOM) at the start of the file, which tells Excel to use the correct UTF-8 encoding automatically.
Step-by-Step: How to Fix International Characters in CSV
- Open your export profile and go to the Output block.
- Select CSV as the output format.
- Locate and check the box labelled “Output UTF-8 BOM”.
- A more advanced (but also effective) alternative in the CSV settings is to manually change the Character Encoding field from
UTF-8toISO-8859-1. Use this only if the UTF-8 BOM method fails.
Once these steps are done, any CSV generated will open directly in Excel without special import wizards.
2. XML Files: Creating a Root Tag with Custom Attributes
When integrating with enterprise ERP systems, the XML export often needs a root tag that includes specific attributes, like version="1.0" or xmlns="http://www.example.com". The standard XML tab interface has dedicated fields for the tag names, but how do you add custom attributes?
The Solution
The trick is to leave the standard “Root tag” field empty and use the “Prepend XML” and “Append XML” fields to construct the tag manually.
Step-by-Step: How to Add Custom Attributes to an XML Root Tag
- In your export profile, navigate to the Output block and select XML as the format.
- Locate the Key XML Settings section.
- Leave the Root tag field completely empty.
- In the Prepend XML field, enter your desired opening tag with attributes, for example:
<Orders version="1.0" xmlns="http://www.example.com">. - In the Append XML field, enter the corresponding closing tag:
</Orders>. - Fill in the Order tag, Product tag, and Coupon tag as usual.
The final output will be a perfectly valid XML document with your custom root tag.
3. TSV Files: Renaming .tsv to .txt
Some older or highly specific legacy systems are programmed to accept only the generic .txt extension, even though the content inside is tab‑separated data. The plugin’s TSV export naturally creates a .tsv file, which these systems might reject.
The Solution
The fix does not involve changing the actual data structure, only the file extension. This is done in the Export filename field.
Step-by-Step: How to Rename TSV to TXT
- Open your export profile and navigate to the Export Now tab.
- Locate the Export filename field.
- Manually change the extension from
tsvtotxt(e.g., changeorders-export.tsvtoorders-export.txt). - Run the export as usual.
The internal structure of the file will remain tab-separated, but it will now be delivered with a .txt extension, satisfying the external system’s requirements.
4. Additional Advanced Order Export Troubleshooting: The Output Block
Downloading Problems with XLS/XLSX Files
Symptom: Clicking the export button for an XLS or XLSX file results in a blank page, a browser timeout, or a “critical error” message.
Probable Cause: This is frequently caused by insufficient server resources (PHP memory) when processing a very large dataset. It can also be caused by a conflict, where another active plugin or the active theme is outputting extra spaces or characters that corrupt the binary Excel file.
Advanced Order Export Troubleshooting Checklist for XLS Issues:
- Increase PHP Memory Limit: Add
define('WP_MEMORY_LIMIT', '256M');to yourwp-config.phpfile. If the issue persists, increase it to512M. - Use the Progress Bar: Use the standard Export button (with the progress bar) rather than the “w/o progressbar” button.
- Check for Plugin Conflicts: Temporarily deactivate all other plugins except WooCommerce and this one. If the issue resolves, reactivate them one by one to find the culprit.
- Check Your Theme: Switch to a default WordPress theme (like Twenty Twenty-Four). If the export works, the issue is in your custom theme’s code.
Custom PHP Code Not Working in Output Formats
The Misc Settings section contains a powerful checkbox: “Custom PHP code to modify output”. This allows you to hook into the plugin and manipulate the data or even the file format itself. However, custom code can also be the source of errors.
Troubleshooting Checklist for Custom PHP Code:
- Syntax Check: Ensure your PHP code has no syntax errors. A single missing semicolon can break the entire export.
- Check the Hook: If you are overriding a format, make sure you are using the correct filter (e.g.,
woe_filter_csvfor CSV). - Enable Debug Mode: Check the “Enable debug output” checkbox to see the raw output. This can help you see if your code is generating extra whitespace or output before the file header.
- Check for Conflicts: If you are using the Code Snippets plugin as well, ensure your export snippet isn’t conflicting with another active snippet.