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.

attempt to dynamically populate product price

  1. i'm trying to pass from my custom post type, the value of a trip to the form to collect a trip deposit. i'll eventually be calculating 20% of the trip rate, but it's not passing this data through. guidance appreciated.

    add_filter('gform_field_value_trip_deposit', 'populate_post_trip_deposit');
    function populate_post_trip_deposit($value){
        global $post;
    
        $trip_rate_value = get_post_meta($post->ID, 'trip_rate');
        return $trip_rate_value;
    }
    Posted 12 years ago on Saturday April 7, 2012 | Permalink
  2. Can you post a link to your page/form by chance?

    Posted 12 years ago on Monday April 9, 2012 | Permalink
  3. sorry. i will try to get something up to demonstrate tonight. basically on this page, i want to have a button, 'book your trip'. based upon the value of the trip rate, calculate 20% of that and pass that price dynamically to the form page where they can specify the quantity (number of travelers) and book through paypal. the Query string works, but i want the value hidden so users can't edit the value.

    Posted 12 years ago on Monday April 9, 2012 | Permalink
  4. http://causemetotravel.com/wordpress/trip/tahiti-and-the-tuamotus-islands/
    added my 'book trip' which is in the blue box. right now it's passing through query string, but i'd prefer through the hook. is this possible?

    Posted 12 years ago on Tuesday April 10, 2012 | Permalink
  5. OK I think I have a solution for you, hopefully this works in your situation based on my example I made here. I can email you the XML file for the form created as well, if you'd like.

    So we have this form here:
    http://grab.by/d1ci

    The Trip ID field is set to be admin only and to be populated dynamically (this is what will control our pricing). The three trip prices I have conditional logic on to only show when the matching trip id is passed.

    So you can see the result here, each of the three trips shows the appropriate price, so no one can change the price on you for that particular trip, unless they want more than 1 of course.

    http://dev.outerhavenstudios.com/trip-form/?trip_id=Trip%201
    http://dev.outerhavenstudios.com/trip-form/?trip_id=Trip%202
    http://dev.outerhavenstudios.com/trip-form/?trip_id=Trip%203

    Posted 12 years ago on Tuesday April 10, 2012 | Permalink