MySQL Query to Get All Coupon

One of my answer in StackOverflow on Question How WooCommerce Coupons are stored in Database? has got many hits, So I thought to put a whole query in this tutorial which might help other developers.
Let me know in the comment if this helps you or not if it helps then do hit the FB like button and share with other WooCommerce developers.
Hello. Could You please take a look:
https://stackoverflow.com/questions/49290446/creating-product-while-creating-listing
I saw You solved similar matter. thanks
Good, this is what I was searching for in google
Hello, i want to select and delete all 30 percent coupons from my database, how can i do that ?
Hi Robert,
Here is the
WP_Query
which will fetch all the coupon having 30% discount, now you just needs to loop it and delete it usingwp_delete_post( int $postid, bool $force_delete = false )
Hope it helps!
Hi, this is great, thank you!
Is it possible to somehow also add detail of the customer that used the coupon? Like their name or email address?
all my coupons has a usage limit of 1.
Thank you
Schalk
Hi, thank for tutorial, but how to import coupon in database table?
Hi Andry,
If you run this query in phpMyAdmin then you will get an option to export the resultset in the form of CSV.