While running your WooCommerce store it might become necessary to refund a large number of customer orders.
Refunding an order is possible via the WordPress dashbord, but if the number of orders is more than 100 you might want to do this programmatically using a script and WP CLI.
Here are some examples of why you might need to refund large numbers of orders:
- An online class is cancelled.
- Vendor did not deliver stock.
- Product stock was incorrect and items were oversold.
- Product price has changed and partial refund will be given to customers.
For this how to you’re going to need shell or ssh access to the server you’ll be working on. In this post I’m going to share parts of a script we use to bulk refund large numbers of WooCommerce orders programmatically.
- Get input for the script
- WooCommerce Helper Functions
- Organizing the WP CLI script
- Programmatically refunding a WooCommerce order
- Check the script output
Now, let’s get started with the script!Read More…