I want to get refunded transaction data with all details of the product like product id and how much quantity refunded.
Can I get all details in array format?
I want to get refunded transaction data with all details of the product like product id and how much quantity refunded.
Can I get all details in array format?
You must be logged in to post a comment.
First of all +1 for your question. From
WooCommerce 2.2
onwards, WooCommerce directly allows refunds if your payment gateway allows. Refunding can be done in 2 ways: Automatically via Payment Gateway or Manually. Please refer the page: http://docs.woothemes.com/document/woocommerce-refunds/ for more information. If you want to get the refund details please use the methods listed in this page: http://docs.woothemes.com/wc-apidocs/class-WC_Order.html.I haven’t found a proper way to do this using built in WooCommerce classes (reports by day is…close). I dug through queries used by WooCommerce to pull report data and came up with the following to get refunded order items:
It’s very close to what WC is using to grab data for various reports. As I write this I would suggest that if you need custom reporting from WooCommerce you will likely have to do things yourself via custom queries or
get_order_report_data
inWC_Admin_Report
.I know this is almost a couple years old, but it’s the only discussion I found regarding obtaining refund data. Anoop’s answer is correct, but to better clarify, the refund methods from WC_Order should return what’s neededL https://docs.woothemes.com/wc-apidocs/class-WC_Order.html
Example: I’m building a list of “attendees” to an event-style product. The number of attendees looks at purchased orders’ quantities of that product/event. Refunding by way of quantity doesn’t actually adjust the order’s quantity, but rather the quantity of items refunded are stored here:
General refund details can be obtained with: