Skip to content

Instantly share code, notes, and snippets.

@DumahX
Created December 2, 2021 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DumahX/f8c4a68e715745b730bf1055fce2cb74 to your computer and use it in GitHub Desktop.
Save DumahX/f8c4a68e715745b730bf1055fce2cb74 to your computer and use it in GitHub Desktop.
<?php
// Attach a phone number custom field when creating a Stripe Customer object.
// Replace mepr_phone_number with the actual slug of the phone number custom field in MemberPress.
function mepr_stripe_customer_extended_args($args, $user) {
$phone_number = trim(get_user_meta($user->ID, 'mepr_phone_number', true));
if(!empty($phone_number)) {
$args['phone'] = $phone_number;
}
return $args;
}
add_filter('mepr_stripe_create_customer_args', 'mepr_stripe_customer_extended_args', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment