PayPal Pro – Sending a Custom Product Label and Description

If you need to define a custom product name and description within PayPal using the PayPal Pro add-on, this snippet will allow you to do so:

add_filter( 'gform_paypalpro_query_1', 'add_additional_information', 10, 3 );
function add_additional_information( $query_string, $form, $entry ) {

	// break the query string into an array after removing the initial '&' character
	parse_str( ltrim( $query_string, '&' ), $query );

	// Set your custom values
	$query['L_NAME0'] = 'Your custom product name here';
	$query['L_DESC0'] = 'Your custom description here';

	// put it all back together again
	$query_string = '&' . http_build_query( $query );

	// return the query string
	return $query_string;

In this snippet change gform_paypalpro_query_1 to the ID of your form.