8

I am using Woocommerce plugin for my custom product .and I am stuck with a situation .

Does Woo commerce provide any hook or filter when refund is done through admin panel and refund will be manually.For More details please see attached image

1
  • 2
    When that button is clicked, javascript is called to update the UI to show refund options. It will not trigger any hook. Do you mean to ask if any hooks are triggered when such a refund is confirmed? Aug 30, 2017 at 16:41

2 Answers 2

14

Although this answer is little late but anyone else may get benefit from it. The woocommerce_order_refunded hook is called when an order is refunded. Use the following example:

// add the action 
add_action( 'woocommerce_order_refunded', 'action_woocommerce_order_refunded', 10, 2 ); 
// Do the magic
function action_woocommerce_order_refunded( $order_id, $refund_id ) 
{ 
  // Your code here
}
2
  • i am newby here but its perfect answer for me. thanks buddy @Tech Dog Feb 1, 2019 at 10:42
  • i have small question from which table i will get refund objec Feb 1, 2019 at 11:12
1

My answer is for emails or when refunds are done through the payment gateway but it might help someone coming across this. So in addition to Tech Dog's answer You can use a few other hooks specifically for partial refunds: woocommerce_order_partially_refunded and for full refunds: woocommerce_order_fully_refunded

These hooks can be seen here (I copied the lines at version 5.9 of WooCommerce, so depending on when someone is reading this the hooks might be on different lines in the latest version)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.