Skip to content

Instantly share code, notes, and snippets.

@kimwhite
Last active June 25, 2024 16:25
Show Gist options
  • Save kimwhite/83cfb4d96b0fbf877a3f69029a7fb162 to your computer and use it in GitHub Desktop.
Save kimwhite/83cfb4d96b0fbf877a3f69029a7fb162 to your computer and use it in GitHub Desktop.
<?php // do not copy this line.
/**
* This recipe will send specific user fields to your Stripe payment description
* This will only appear on the initial payment, not recurring orders
*
* 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.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function mypmpro_stripe_description( $description, $order ) {
// Retrieve user meta with default empty string if not set
$user_title= ! empty( $_REQUEST['user_title'] ) ? sanitize_text_field( $_REQUEST['user_title'] ) : 'N/A';
$dioscese = ! empty( $_REQUEST['dioscese'] ) ? sanitize_text_field( $_REQUEST['dioscese'] ) : 'N/A';
// Construct the description
$description = "Title: " . $user_title . ", " ."Dioscese: " . $dioscese;
return $description;
}
add_filter( 'pmpro_stripe_order_description', 'mypmpro_stripe_description', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment