Last active
June 25, 2024 16:25
-
-
Save kimwhite/83cfb4d96b0fbf877a3f69029a7fb162 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 // 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