WooCommerce: display coupons used in an order in the confirmation email and on the edit page

Remi | November 8, 2013 | in WooCommerce

Here is a nice snippet that i really like. It will allow you to show the coupon codes used in order on the order edition page, and on the confirmation email. The snippet provides two functions, one for each action, and using the following hooks woocommerce_email_after_order_table and woocommerce_admin_order_data_after_billing_address. Then, the code is pretty much the same, it uses get_used_coupons() to retrieve coupon code. Here is the result in the administration:


Simply add this snippet to the file called functions.php within your theme folder:

The author

About the author Remi: Hey! My name is Rémi Corson, i'm a WordPress Expert Developer, i create high level themes and plugins, and i provide free stuff every week on this website!


  1. Pingback: Weekly Roundup: November 15, 2013 - Sell With WP

  2. theswine

    Great snippet.

    We are in need of the same thing on the PDF printable invoice ??

    It doesn’t show the coupon code, just the dollar off amount ?

    Any way to show the coupon code on the “PDF Invoice” that we print ??

    Thanks so much NINJA!

    1. Remi Post author

      hooking the custom_checkout_field_display_admin_order_meta() function to the proper filter in the PDF invoice should work (however i don’t have it in mind!)

      1. lexY123

        Hello Remi, can you elaborate further on this please? Do you mean adding something like this in PDF Invoice Template’s Template.php?

        Please advice :(

  3. timmathews

    Hi Remi, I’m Tim. Just found your site and I love it, but I still can’t find what I need and maybe you can assist.
    We did a groupon type deal, issued 1k coupon codes and sold 400.
    Problem is, I don’t want to scroll through 60 pages of coupons to try to find the ones that are used. Is there a way to sort the coupons? Say, click the “usage / limit” head and it will sort? This way, I can go to the first pages and see the 331/*, the 1/1 coupons then eventually come to the 0/1 coupons.
    Any help or ideas?
    Thank you in advance,

  4. macttu

    Hey Remi,

    I’m new to your site and somewhat of a newb to WooCommerce and WordPress. I have added your “show username” snippet to the functions.php and it worked perfectly………when I try to add this code to the bottom of my functions.php, the code shows up above the header on my site(AggielandVIP.com).

    Would there be a specific location on the functions.php where I should put this? I’ll order a $5 item if you can help me get this implemented as it would be a great addition to my site!

    Thanks in advance for any help you can provide keep up the great work!


  5. ansleyRDgroup

    How do we get this on the “processing order” (customer receipt) email? Your code works great for the Order management/edit screen and the coupon is included in the “new order” email but it does not appear in the customer receipt (what woocommerce labels as the “processing order email”)

    Thank you and great post!
    Jason Ansley
    Full Service Business Development Concierge, Coaching, & Consultancy

    1. schalkjoubert

      To explain further;
      At times the site admin need to complete an order which is placed telephonically, for someone that already has a customer account.
      It is just so much simpler to do it from the backend.

  6. Collin

    This doesn’t appear to work with WooCommerce 2.6+. After I add this to my theme’s custom functions PHP file I don’t see an errors but nothing new appears in the “new order” admin emails. Any chance you can update the code, Remi?

  7. iengage365

    Hi, is there anyway to ad script to the code to populate a custom field against the order so when we export the order record with the coupon cold also?


  8. surbhi2991

    I have activated WooCommerce in my site for the first time, & i have a question.
    I want to display Applied Coupon Code in Email Template Which is sending to Admin on Every New Order Placement.
    Let me know which file or which code i need to apply for this situation.
    Main query is i have to do this using another plugin, so can you tell me how to access New Order Email template in another plugin and add applied coupon code in email template then send mail.


Leave a reply