Skip to content

Instantly share code, notes, and snippets.

@ericnicolaas
Last active August 11, 2020 08:36
Show Gist options
  • Save ericnicolaas/753e76e50bb1894452648096de5119ff to your computer and use it in GitHub Desktop.
Save ericnicolaas/753e76e50bb1894452648096de5119ff to your computer and use it in GitHub Desktop.
Set PayPal descriptor to be parent campaign name
<?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