• Resolved tarkan

    (@tarkan)


    Been testing this plugin to replace the official WooCommerce stripe plugin.

    Only issues in my testing so far, is that the refund metadata is missing the reason comment, which the official plugin includes.

    Do you have a code snippet to include it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Metadata in refunds’ is closed to new replies.