Advanced Order Export for WooCommerce

WooCommerce TM Extra Product Options

Selling personalized products? Customer selects age, gender, and custom labels?

The previous code created separate rows per option. This one does something different.

Each option becomes its own column. One product row. Many option columns.

What this code does

Turns TM Extra Product Options into individual columns. Perfect for spreadsheets where each product should appear once.

Example columns: “Age”, “Gender”, “Label1”, etc.

The complete code

You should EDIT and TWEAK code! See below how to get “Element id”.

Setup steps

  1. Edit the $tm_fields array to match your actual TM options

Look at your order edit screen. Find the “Extra Product Options” section. Note the exact labels.

In the example image:

  • “Front Label” with value “Happy Birthday!”
  • “Gender” with value “Male”
  • “Age” with value “12”

So the array should be:

  1. Copy the code into your theme’s functions.php
  2. Go to Advanced Order Export for WooCommerce
  3. Create or edit an export profile
  4. Open Setup Fields → Products
  5. You’ll see your option columns. Check the ones you need
  6. Save and test on an order with TM options

What your export looks like

One product row. Multiple option columns.

ProductAgeGenderFront Label
Birthday Card12MaleHappy Birthday!

Much cleaner than one row per option.

Mapping multiple TM fields to one column

Sometimes different products use different field names. “Age” on one product. “Child Age” on another.

The code handles this. Map both to the same column:

All three source fields go into the “Age” column.

Customizing output

Change format_line() to show different data:

Show option name and value:

Show price too:

When you need this

You sell many customizable products. Each product has 5-10 options.

You prefer one row per product. Not 10 rows per product.

Your spreadsheet needs to be compact. Easy to read.

You compare options across different products in the same row.

Common mistake

The field names must match exactly. “Front Label” won’t match “FrontLabel” or “front label”.

Check your order edit screen. Copy the label exactly as shown. Paste into the array.

Empty columns?

The TM field wasn’t filled for that product. Or the field name doesn’t match.

Add debugging. Temporarily add var_dump($product_fields) inside fill_tm_fields(). See what TM data exists.

Pro tip

Hide TM columns you don’t need. Uncheck them in Setup Fields. Your export stays clean.

Need both row-per-option AND column-per-option? Create two export profiles. Use the previous code for one. This code for the other.

Real talk

TM Extra Product Options stores data in complex arrays. This code flattens them into simple columns.

Your team gets one row per product. All options visible horizontally. No scrolling through duplicate rows.

Perfect for weekly reports. Accounting reviews. Or any situation where compact = better.

Have questions? Please submit a support request. We're always happy to help!

Advanced Order Export
for WooCommerce
PRO

From $30
Buy
✓ 30-day money-back guarantee