PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Change PayPal Description?

  1. KindraPB
    Member

    I want to add a function that changes the Description (field label) sent in the PayPal post. I have a function that changes the price value depending on the type of post the user is paying for. So I would like the type of post to be sent in the description. Would I use:

    <?php
    add_filter("gform_product", "change_product", 10, 2);
    function change_product($label, $form_id){
    //find users post id
    //use id to find post type
    $post_type = //post_type;
        return $post_type;
    }
    ?>
    Posted 12 years ago on Friday November 2, 2012 | Permalink
  2. The gform_product filter just changes the name "Product" to whatever you want, an the entry detail page. Documentation: http://www.gravityhelp.com/documentation/page/Gform_product

    What code are you using currently to change the price? Maybe we can incorporate the two functions.

    Posted 12 years ago on Sunday November 4, 2012 | Permalink
  3. KindraPB
    Member

    I am currently getting a distance for the user that is posting a housing listing and depending on how far away they are from a certain point the price changes. So in the paypal details I would like to include the distance. I am using:

    add_filter("gform_field_value_price", "populate_price");
    function populate_price($value){
    
    	$id = get_current_user_id();
    	$args=array(
     	 'author' => $id,
     	 'post_type' => 'listing',
     	 'post_status' => 'pending',
     	 'numberposts' => 1
    );
    $my_posts = get_posts($args);
    if( $my_posts ) {
    
    $post_id =$my_posts[0]->ID;
    }
    
    	$distance = get_post_meta($post_id, 'distance', $single);
    
    	if($distance[0]>10)
    	{
    		$price = "$50.00";
    	}
    	else
    	{
    		$price = "$35.00";
    	}	
    
       return $price;
    }
    Posted 12 years ago on Monday November 5, 2012 | Permalink
  4. Sounds like this gform_field_value_price is working for you now and you will have the distance available. I would probably store that in the entry so you have it available later. To change the information being sent to PayPal you can use the gform_paypal_query filter: http://www.gravityhelp.com/documentation/page/Gform_paypal_query

    I don't think you will be able to incorporate the two functions. You can leave what you have working here alone, and add the gform_paypal_query to add to the information being sent to PayPal.

    Posted 12 years ago on Thursday November 8, 2012 | Permalink