Hi @tarkan,
I’ve made a note to include the reason text in the metadata. Here is an example of how you can add that info:
add_filter('wc_stripe_refund_args', function($args, $payment_object, $order){
$refunds = $order->get_refunds();
$refunds = $order->get_refunds();
/**
* @var \WC_Order_Refund $a
* @var \WC_Order_Refund $b
*/
if ( \is_array( $refunds ) ) {
usort( $refunds, function ( $a, $b ) {
return $a->get_id() < $b->get_id() ? 1 : - 1;
} );
}
$refund = $refunds[0];
$args['metadata']['reason'] = $refund->get_reason();
return $args;
}, 10, 3);
I would recommend using a code snippet plugin like this one to add this to your site.
Kind Regards
Thread Starter
tarkan
(@tarkan)
Thanks @mrclayton, I am in no rush – I will wait for it to be included in the plugin.
I can see the refund function in your plugin already has the ‘reason’ in the call just need to include it in the request metadata sent to stripe. Should be easy to add.