I had personally gone through this requirement for quite a long time and finally reached a working solution. I decided to share it with you all so that your headache is gone also. I struggled a lot actually, with Woocommerce refunds before and I was deleting individual download permissions manually.

When I found this solution, life was never easier before. If you have frequent Woocommerce refunds for digital downloads then this hack will be a life saver.

Steps To Delete Multiple Digital Download Permissions In A Woocommerce Order, From MySQL using phpMyAdmin

There are two different codes are there for two types of deletion.

1. To delete all permission downloads from selected ORDERS ID (Here replace “ORDER ID1” with the desired order number, also change WordPress SQL table starting name to actual value (here table starts with “wp“))


FROM wp_woocommerce_downloadable_product_permissions
WHERE `order_id` IN (ORDER ID1);

Please check the below image to get an idea about executing the code. Once you copy paste the above code in the “Console” press “Ctrl” + “Enter” keys to execute it.

Please note that the above code will execute in mentioned Order ID’s only.


2. To delete permission for all Refunded Orders:

The below code will delete download permissions for all orders which were refunded.


FROM wp_woocommerce_downloadable_product_permissions
SELECT 1 FROM WHERE wp_posts.ID = wp_woocommerce_downloadable_product_permissions.order_id
AND wp_posts.post_status = ‘wc-refunded’);

Hope this tutorial was helpful to you. If it really helped please spread the word.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.