Have you heard of Post Status club yet? If you’re a WordPress professional, it’s an excellent membership club that I’m a part of along with hundreds of WordPress professionals, and one of the reasons we love it is the fantastic Slack community where members chat about their WordPress-based businesses.

We recently got an interesting question in the club Slack chat that we thought would make a great tutorial: How do I export WooCommerce orders based on the coupon used so I have a single list?

It’s not quite as simple as you may think, as there’s on basic problem with the way WooCommerce gives you a list of coupons used.

The Problem: Getting Orders for a Coupon

If you view your coupons under WooCommerce > Coupons, you’ll see a “Usage” column for your coupons. If you click on the usage count for a particular coupon, it should give you a list of all orders in which that coupon has been used.

WooCommerce coupon usage count

However, that’s not quite the case. Clicking the coupon usage link uses the order search function. This searches all order text for the coupon’s code, which can be very problematic if your coupon code string is also contained in a product name, a customer name, or other text in the order.

Rather than getting an accurate list of coupon usage, you’ll simply get a list of all orders that contain the coupon code text in some way. For example, rather than getting 2 orders that have used the wooninja code, we’ll get a 2-page (!) list of orders in my test shop, as that’s also the SKU of one of my products.

WooCommerce coupon usage: incorrect count

Incorrect Orders List

In order to accurately get a list of orders that use a particular coupon, we’ll need to use a plugin to do proper order filtering, and then use an order export plugin that will allow us to export these in bulk.

1. Install WooCommerce Filter Orders

A while back when I ran into this problem, I built a simple little plugin that will let you properly filter orders by the coupon used, instead of searching orders for the coupon code text. In order to get an accurate list of orders that have used a particular coupon, you can install this plugin, and it will add a dropdown to the top of your orders list where the rest of the filtering options are.

Download WooCommerce filter orders plugin

When you use this, use the “Filter by coupons used” dropdown on the “Orders” list instead of clicking coupon usage, and then you’ll get the correct list of orders that have used this coupon.

WooCommerce Orders filtered by coupon

Correct filtering

There is an important note on the way WooCommerce stores coupons used within an order: WooCommerce only stores the coupon code in the order, not the ID or slug, which is a slight downside, as you can change the coupon code.

This means that if you ever change the coupon code, you can’t filter orders to get a list of every order that used this coupon before and after the code change, and that you probably don’t want to change your coupon codes if you want filtering to work properly.

2. Install WooCommerce Order CSV or Order XML Exporter

Next up, you’ll need to install an order export plugin. The WooCommerce XML Customer / Order export ($99) or WooCommerce CSV Customer / Order export ($79) plugins will be used in this example since they both have a bulk action that lets you select orders and export them.

This way, we can:

  1. easily filter by coupon,
  2. select all orders with this coupon, and
  3. export the entire list of orders in one file.

3. Filter Orders by Coupon and Bulk Export

Now that you’ve got the filtering plugin and your export plugin installed, you can filter orders by the coupon used, and export them all in one list easily. Select all of your orders, and use the “bulk actions” dropdown.

This will let you download all of the selected orders within one CSV file by clicking “Download to CSV”:

WooCommerce export orders to csv

Export filtered orders list to CSV

Or within one XML file by using “Download to XML”:

WooCommerce export orders to xml

Export filtered orders list to XML

This gives you an accurate, combined list of all orders that have used this particular coupon.


Note: This post may contain affiliate links, which means we get a commission from the plugin, theme, or service provider if you choose to purchase. Regardless of this, we are committed to providing high quality, unbiased resources. Have more questions? See our affiliate policy. You can use the plain links below if you prefer that we not receive a referral commission:
Articles you may also like:

Posted by Beka Rice

Beka Rice manages the direction of Sell with WP content and writes or edits most of our articles to share her interests in eCommerce. Or she just writes as an excuse to spend more time jamming out to anything from The Clash to Lady Gaga. Who knows.

Leave a reply

Your email address will not be published. Required fields are marked *