Add Calculated Field (For Order)
Need a column that doesn’t exist? Combine state and postcode. Format phone numbers. Create custom text.
Here’s how to build your own calculated fields in Advanced Order Export for WooCommerce.
Step 1: Create an empty custom field
First, add a placeholder field to your export.
- Click Confirm
- Open Setup Fields in Advanced Order Export for WooCommerce
- Click the Common tab
- Click Add Field button
- Type your meta key in the text box (below the dropdowns)
- Fill in Column name (what your CSV header will show)
In the screenshot, “custom_address” is the meta key. “Custom Address” is the column name.
Now move your new field from the right column to the left. That’s your exported fields list.
Click Preview. The column shows empty values. That’s normal.
Step 2: Add the calculation code
Now tell the plugin how to fill that column.
Paste this template into the textarea:
- Close Setup Fields
- Open Misc Settings
- Check Custom PHP code to modify output
- Paste this template into the textarea.
- Replace
FIELDwith your meta key (from Step 1) - Replace
$value = "text"with your actual calculation
|
1 2 3 4 |
add_filter('woe_get_order_value_FIELD',function ($value, $order,$fieldname) { $value = "text"; return $value; },10,3); |
Parameters for the hook:
$value is string
$order is WC_Order object
$fieldname is string
Real example from the screenshots
Meta key: custom_address
Goal: Combine shipping state and postcode with a dash.
Final code:
|
1 2 3 4 |
add_filter('woe_get_order_value_custom_address', function($value, $order, $fieldname) { $value = $order->get_shipping_state() . '-' . $order->get_shipping_postcode(); return $value; }, 10, 3); |
What the export shows
One column. Combined data. No manual Excel formulas needed.
Debugging
Preview shows empty column? Something’s wrong.
Check Enable debug output in Misc Settings. Run the export again. PHP errors will appear.
Common mistakes:
- Wrong meta key (misspelled)
- Missing semicolon at line end
- Using
$order->get_shipping_state()but shipping state is empty
Pro tip
Test with one order first. Use the Preview button with small preview size (5 orders).
Once it works, save your profile. Run full export.
Real talk
Calculated fields are powerful. You can build almost anything.
Start simple. Combine two fields. Get that working. Then add conditions or formatting.
The code runs for every order. Keep it efficient. No heavy database queries inside the loop.


