Mailchimp Banner | Q2 2024

added by Latoya

Product Icon

PayPal Payments

by  Woo
One checkout solution. Many ways to pay. PayPal’s all-in-one solution allows you to offer PayPal, Venmo (US), Pay Later at no additional cost, credit and debit cards, and country-specific payment options.

Allow saving last four digits of credit card

When a customer pays with a credit card, it should save the card type and last four digits of the credit card so that it can be displayed where needed.

My workaround is to add the following snippet in OrderProcessor.php before the end of the process(WC_Order $wc_order) function:

$card_brand = ”;
$last_digits = ”;
if (!is_null($order->payment_source()) && !is_null($order->payment_source()->card()))
{
$card_brand = $order->payment_source()->card()->brand();
$last_digits = $order->payment_source()->card()->last_digits();
}

if (!empty($card_brand) && !empty($last_digits)) {
$wc_order->update_meta_data( ‘payment_cc_info’, $card_brand . ” *” . $last_digits);
$wc_order->save();
}

I then get the payment_cc_info meta data where needed.
This is obviously not the best way to handle it and requires a modification every time the plugin updates so an official way to handle this would be appreciated.

Author

bkabsedev

Current Status

Open

Last updated: January 3, 2024

0 comments

Log in to comment on this feature request.