Visser Labs – WooCommerce Plugins
  1. Home
  2. Knowledge Base
  3. WooCommerce Store Exporter Deluxe
  4. How to export WooCommerce data to JSON
  1. Home
  2. Knowledge Base
  3. File Formats
  4. How to export WooCommerce data to JSON

How to export WooCommerce data to JSON

If you’re feeding store data into a script, an API, or another system, a flat spreadsheet gets in the way. JSON gives you each record as a self-contained object that nearly every programming language and integration tool can read directly. Store Exporter Deluxe can export any supported data type as JSON through its CRON export URL. Below, you turn on CRON exports, build the URL that returns JSON, and learn how to read, open, and customize the output.

Prerequisites

RequirementDetails
PluginStore Exporter Deluxe installed, active, and licensed
WooCommerceActive, with at least one record of the type you want to export
Administrator accessYou’ll need an account with access to the WordPress admin dashboard
A way to request a URLA web browser is enough. A tool such as curl or wget works too if you want to automate it

JSON isn’t one of the File Format tiles on the Quick Export screen, and it isn’t offered in Export Templates. You request it through the CRON export URL instead, as described below.

Step 1: Turn on CRON exports

  1. Go to WooCommerce → Store Export.
  2. In the sidebar, click Settings.
  3. Click CRON Exports.
  4. Turn on Enable CRON.
  5. Enter a long, random value in Export Secret Key.
  6. Under Export Fields, choose which fields a CRON export includes.
  7. Click Save Changes.

Enable CRON is off by default. While it’s off, the plugin ignores the export URL. It also ignores any request whose key doesn’t match Export Secret Key, and every request while that field is empty. Treat the key like a password, because anyone with the key and your URL can download your store data.

The Export Fields options are:

  • All export fields: includes every known field for the export type you request.
  • Use Export Template: uses the fields from a saved Export Template.
  • Saved field preferences: uses the fields you saved on the Quick Export screen for that export type.
The CRON Exports settings page with the Enable CRON toggle on, an Export Secret Key entered, and Export Fields set to All export fields

Step 2: Build the export URL

Start from your site address and add the parameters below. Replace YOUR_SECRET_KEY with the key you set in Step 1:

https://example.com/?action=woo_ce-cron&key=YOUR_SECRET_KEY&type=product&format=json&response=download
ParameterWhat it does
actionAlways woo_ce-cron. This tells the plugin the request is a CRON export.
keyYour export secret key.
typeThe data to export: product, category, tag, brand, order, customer, user, review, coupon, subscription, product_vendor, commission, shipping_class, ticket, or booking. The subscription, product_vendor, commission, ticket, and booking types need the matching plugin to be active. Without it, the export has no records.
formatSet to json. If you leave it out, the export defaults to CSV.
responsedownload sends a .json file to your browser. raw prints the JSON straight to the page, which suits scripts and API-style requests.
limitOptional. The maximum number of records to export. Leave it out to export everything.
offsetOptional. The number of records to skip, which helps when you export a large store in pieces.

Step 3: Run the export

Open the URL in your browser. With response=download, your browser saves a file named like my-store-export_product-2026_10_20-07_18_54-93680224.json. With response=raw, the JSON appears on the page instead.

To automate it, request the same URL from a script or a scheduled job on your server:

curl -s "https://example.com/?action=woo_ce-cron&key=YOUR_SECRET_KEY&type=order&format=json&response=raw" -o orders.json

What the output looks like

The file is one JSON object. Its single key is the export type, and its value is a list of records. A Products export looks like this:

{
    "product": [
        {
            "productid": "15",
            "productsku": "HD-FLC-CLS",
            "productname": "Classic Fit Fleece Hoodie",
            "parentsku": {}
        }
    ]
}
The start of a Products JSON export, with the export type key, an empty value written as {}, and a product ID written as text, each marked with a callout

A few things are worth knowing before you build anything on top of it:

  • Field names are simplified: each field’s name is its column label in lowercase, with spaces and most symbols removed. Hyphens and underscores stay. So Product Name becomes productname, and E-mail becomes e-mail.
  • Every value is text: numbers, prices, and IDs are written as strings, such as "15" rather than 15. Convert them in your own code if you need numeric types.
  • Some values are written as {}: a field with no value is written as {}, not "" or null. The Category field of a Products export, and text that holds special characters such as non-breaking spaces, also come through as {}. If you need those values, export the same data as XML or CSV.
  • Orders carry an extra key: each order record also includes an @attributes entry holding the order’s ID.
  • A single record isn’t wrapped in a list: if your export contains exactly one record, the export type’s key holds that record directly instead of a one-item list. If you pull in one record at a time using limit=1, handle both shapes in your code.
  • The output is pretty-printed: the file uses indentation and line breaks so it’s easy to read.

Format-specific options

JSON exports have no settings of their own. There’s no delimiter or structure option to choose, and the file is always UTF-8. General settings still apply, so Date Format controls how dates appear in the JSON. Settings that only apply to other formats, such as Field Delimiter and Line Ending Formatting (CSV and TSV), don’t change a JSON file. To change the JSON itself, use the hooks in the developer section below.

Opening your JSON file

  • Web browser or code editor: open the file in any modern browser, VS Code, or a text editor. Most editors can collapse and expand each object.
  • Command line: use jq to filter and reshape it, for example jq '.product[].productsku' products.json.
  • API tools: tools such as Postman can load a JSON file as a request body or as sample data.
  • Spreadsheets: Excel’s Get Data → From File → From JSON option (Power Query) can flatten the records into rows. If you mainly want a spreadsheet, a CSV or Excel export is simpler.
  • Your own code: every mainstream language can parse JSON with a built-in or standard library.

Customizing the JSON output with hooks

Store Exporter Deluxe fires filter hooks around the JSON export, so a developer can change the output without editing plugin files. These hooks run for exports requested through the CRON URL.

FilterWhat it does
woo_ce_export_json_constantsSets the options passed to wp_json_encode(). The default is JSON_PRETTY_PRINT.
woo_ce_export_json_before_datasetRuns before the records are added. Receives the empty export object.
woo_ce_export_json_after_datasetRuns after the records are added. Receives the finished export object, before it’s converted to JSON.
woo_ce_cron_allowed_export_typesLimits which export types the CRON URL accepts.

For example, to remove the indentation and keep slashes and non-English characters readable, return different JSON options:

add_filter( 'woo_ce_export_json_constants', function () {
    return JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
} );

The JSON_UNESCAPED_SLASHES option stops URLs from being written as https:\/\/example.com. The JSON_UNESCAPED_UNICODE option keeps characters such as accents and non-Latin scripts as they are instead of turning them into \u codes.

For the wider list of hooks that run during an export, see Available hooks and filters for further customization.

This is a developer customization. If you’re not comfortable adding code through a custom plugin or your theme’s functions.php, open a support ticket and our team can help.

Troubleshooting

The export URL shows my normal home page
Check that Enable CRON is on, that Export Secret Key isn’t empty, and that the key in your URL matches it exactly. When any of these is wrong, the plugin ignores the request and your site loads as usual.
The export URL shows a blank page
The plugin accepted your key, but it didn’t recognize the export type or the format. Check that type is in the URL and is one of the values listed in Step 2. Also check that format is exactly json. The plugin doesn’t recognize any other spelling and returns nothing.
The export shows only null
Your store has no records of that type, so there’s nothing to export. Check that type is the data you expect.
The page shows only 1 or 0
Add &response=download or &response=raw to the URL. Without a valid response value, the plugin returns only a status number instead of the file.
The export URL shows a critical error
Set Character Encoding under Settings → General to UTF-8, or add &encoding=UTF-8 to the export URL. JSON exports don’t work with UTF-16.
The file downloads as CSV instead of JSON
The format parameter is missing. Without it, the CRON export defaults to CSV. Add &format=json to the URL.
My script fails because a field is {}
Make your code accept {} wherever it expects text. Empty fields are written as {}, and so are the Category field and text with special characters such as non-breaking spaces. If you need those values, export the same data as XML or CSV.
The JSON has fewer fields than I expected
CRON exports use the field choice under Export Fields in Settings → CRON Exports. Switch it to All export fields, or to the template or saved selection that contains the fields you need.

Frequently asked questions

Can I choose JSON on the Quick Export screen?
No. The File Format options under Export Options on Quick Export are CSV, TSV, XLS, XLSX, and XML. Use the CRON export URL for JSON.
Can I change the encoding of a JSON export?
No. The JSON file is always UTF-8. If Character Encoding under Settings → General is set to UTF-16, the JSON export fails with an error. Set it to UTF-8, or add &encoding=UTF-8 to the export URL. To change how special characters are written, use the woo_ce_export_json_constants filter.
Does JSON work for every export type?
Yes. Every type in the type list in Step 2 can be requested with format=json.

Need help?

If you have a question or run into any issues, we’re here to help.

Was this article helpful?

Related Articles

Resources & Help