Last active
December 22, 2023 14:19
-
-
Save dparker1005/9e69961ac7f70b2a3daf1afcd6cc7c14 to your computer and use it in GitHub Desktop.
Updates the payment description in Stripe when purchasing a subscription using Stripe Checkout.
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 | |
/** | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
*/ | |
// Copy from below this line | |
/** | |
* Updates the payment description in Stripe when purchasing a subscription using Stripe Checkout. | |
*/ | |
function my_pmpro_stripe_checkout_session_parameters_subscription_description( $checkout_session_params, $morder ) { | |
if ( $checkout_session_params['mode'] === 'subscription' ) { | |
$checkout_session_params['subscription_data']['description'] = $morder->membership_level->name; | |
} else { | |
$checkout_session_params['payment_intent_data']['description'] = $morder->membership_level->name; | |
} | |
return $checkout_session_params; | |
} | |
add_filter( 'pmpro_stripe_checkout_session_parameters', 'my_pmpro_stripe_checkout_session_parameters_subscription_description', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment