Created
January 11, 2020 01:40
-
-
Save joshfeck/7835142b09f8a8a3502b70f9c36ac3b5 to your computer and use it in GitHub Desktop.
Custom Stripe Elements description field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
add_filter( | |
'FHEE__EEG_Stripe_Onsite__doDirectPaymentWithPaymentIntents__payment_intent_data', | |
'stripe_elements_cf_order_desc', 10, 4 | |
); | |
function stripe_elements_cf_order_desc( | |
$stripe_data, | |
$payment, | |
$transaction, | |
$billing_info | |
) { | |
if ($transaction instanceof EEI_Transaction) { | |
$primary_registrant = $transaction->primary_registration(); | |
if ($primary_registrant instanceof EE_Registration) { | |
$event = $primary_registrant->event_obj(); | |
if ($event instanceof EEI_Event) { | |
$desc = $event->name(); | |
$desc .= ' | cost code: ' . get_post_meta($event->id(), 'cost_code', true); | |
$stripe_data['description'] = $desc; | |
} | |
} | |
} | |
return $stripe_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment