Search code examples
woocommerceopayo

Get SagePay CardType value from a Woocommerce order


I'm using Sagepay payment gateway with woocommerce. When an order is processed, Sagepay returns the CardType value and it is visible in the Order Note that is created. I need to get this value.

I was hoping I could get it using wc_get_order but I can't find it.

Can anyone point me in the right direction?


Solution

  • Found it!

    It is in the _sageresult field in the wp_postmeta table.

    $notes=get_post_meta($order_id,'_sageresult',true);
    
    echo $notes['CardType'];