WooCommerce Tips

How to Export WooCommerce Coupons to CSV or Excel Without Losing Restrictions

How to Export WooCommerce Coupons to CSV or Excel Without Losing Restrictions
Coupon Operations · Portable Data

How to Export WooCommerce Coupons to CSV or Excel Without Losing Restrictions

A list of coupon codes is not a coupon backup. The commercial rule also lives in amount, discount type, dates, product and category scope, exclusions, spend thresholds, usage counters, customer restrictions, and extension data.

Merchants export coupons for different reasons: audit, migration, finance review, customer support, campaign analysis, or disaster recovery. Those purposes require different rows and fields. A performance report asks how often a coupon was used and how much it discounted. A configuration export asks what the coupon is allowed to do.

Exporting coupon usage and exporting coupon definitions are different jobs. Decide which one you need before choosing the tool.

Choose the export purpose

Purpose Required data Best starting point
Performance analysis Orders, discount amount, revenue, refunds, date range WooCommerce Analytics Coupons report or campaign analytics
Configuration audit Code, type, amount, restrictions, limits, dates Coupons REST API or purpose-built exporter
Migration All supported core fields plus extension metadata and mapping Importer/exporter tested against both systems
Backup Restorable configuration and database-level context Full site/database backup plus a readable coupon extract

Coupon fields worth preserving

  • coupon ID and code;
  • description and creation/modification dates;
  • discount type, amount, and free-shipping flag;
  • expiry date;
  • minimum and maximum spend;
  • individual-use and exclude-sale-items settings;
  • included and excluded product IDs;
  • included and excluded category IDs;
  • usage limit, per-user limit, product limit, and usage count;
  • allowed email restrictions;
  • extension-specific metadata, ownership, or campaign relationship where applicable.

An empty product_ids array does not summarize the complete scope. Read it beside categories and exclusions; the coupon product_ids guide explains the exact interpretation.

Three practical export methods

1. Analytics CSV for usage results

Use WooCommerce Analytics when the question is which coupons produced orders and discount value during a period. That is a report, not a restorable coupon-definition file. Our coupon usage reports guide adds margin, refunds, customer quality, and abuse context.

2. Purpose-built coupon exporter

Choose a maintained exporter when non-technical staff need filters, scheduled runs, field mapping, and re-import. Confirm that it explicitly supports coupons—not only orders that contain coupon codes—and test extension fields before relying on migration claims.

3. WooCommerce REST API

WooCommerce REST API v3 includes coupon endpoints for listing, creating, updating, deleting, and batch operations. It is a strong source for a controlled export because the response is structured and paginated. It still cannot automatically know how a third-party plugin stores every custom restriction.

A safe REST API export workflow

  1. Create read-only API credentials. Use a dedicated WordPress user with the minimum required capability and revoke the key after one-off work.
  2. Use the current endpoint. Request coupons through /wp-json/wc/v3/coupons.
  3. Paginate until complete. Do not assume the first page contains the catalog. Record response totals and page count.
  4. Preserve raw JSON first. JSON retains arrays and nested values that a flat CSV must encode.
  5. Flatten deliberately. Join product/category ID arrays with an agreed delimiter and document the format.
  6. Add extension fields only after verification. Compare API output with the admin screen and source plugin documentation.
  7. Protect the file. Coupon codes and customer email restrictions can be commercially sensitive or personal data.

Do not place REST keys in spreadsheet cells, browser URLs, public scripts, or shared chat logs. Use environment secrets, HTTPS, least privilege, and a controlled workstation.

Open coupon CSV safely in Excel

  • Import the file through Excel’s data importer instead of double-clicking when codes contain leading zeros.
  • Set coupon-code, ID-list, and email columns to text.
  • Use UTF-8 to preserve descriptions and international characters.
  • Keep ISO dates or an explicitly documented timezone.
  • Prevent spreadsheet formula injection by neutralizing cells that begin with =, +, -, or @ when data is not fully trusted.
  • Do not save a reviewed workbook over the raw export; preserve an immutable source copy.

Verification checklist

  1. Compare total coupon count with the WooCommerce source.
  2. Sample active, expired, scheduled, fixed-cart, percentage, product, and free-shipping coupons.
  3. Confirm empty arrays were not converted to the text “all products” without context.
  4. Check inclusions, exclusions, limits, usage counts, dates, and emails.
  5. Test any re-import on staging and compare cart outcomes, not only saved fields.
  6. Keep a full site backup before migration or bulk update.

Frequently asked questions

Can WooCommerce export coupons directly to Excel?

Excel reads CSV, so the practical output is usually CSV. For definition data, use a purpose-built coupon exporter or transform the WooCommerce REST API coupon response. Analytics exports answer usage questions rather than full configuration backup.

Is a coupon CSV a complete backup?

Not necessarily. Third-party extensions may store rules outside core coupon fields. Keep a full database/site backup and verify every required extension field before treating a CSV as restorable.

Can I export thousands of coupons through the API?

Yes, with pagination and sensible request pacing. Record total pages, retry transient failures, and reconcile the final row count instead of assuming one request is complete.

Key takeaways

  • Usage reports and coupon-definition exports solve different problems.
  • Preserve raw JSON before flattening arrays into CSV.
  • Use read-only credentials, pagination, and least privilege.
  • Protect coupon codes and customer restriction data.
  • Verify a migration through real staging-cart outcomes.