Last active
August 11, 2020 08:36
-
-
Save ericnicolaas/753e76e50bb1894452648096de5119ff to your computer and use it in GitHub Desktop.
Set PayPal descriptor to be parent campaign name
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 | |
function ed_charitable_set_paypal_item_name( $args, $donation_id, $processor ) { | |
$donation = charitable_get_donation( $donation_id ); | |
$campaign_id = current( $donation->get_campaign_donations() )->campaign_id; | |
$parent_id = wp_get_post_parent_id( $campaign_id ); | |
$parent_title = get_the_title( $parent_id ); | |
$paypaldescript = 'LETRGive - ' . $parent_title . ' - #106' . $donation_id; | |
$args['item_name'] = $paypaldescript; | |
return $args; | |
} | |
add_filter( 'charitable_paypal_redirect_args', 'ed_charitable_set_paypal_item_name', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment