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.

Total won't update on gform_product_total

  1. So now that the Total field works again with Otto's Simple Facebook Connect plugin, it doesn't appear to update when I enter a promo code. This used to work. I tested this in Preview, and it doesn't work there, either.

    Here is the code:

    add_filter( 'gform_pre_render_2', 'joe_ind_js' );
    
    function joe_ind_js( $c ) {
    	echo <<<END
    <script type="text/javascript">
    	function gform_product_total( formId, total) {
    		if(jQuery("#input_2_26").val().toLowerCase() == 'xyzpromo' )
    			total -= 30;
    		return total;
    	}
    </script>
    END;
    	return $c;
    }

    One caveat I'll note: This script does work if I fill in the promo code and refresh the screen. Once refreshed, the promo code field is still filled in with the correct promo code.

    Posted 12 years ago on Thursday May 24, 2012 | Permalink
  2. Still broken with the recent update. Maybe there's something I'm not doing right in the code?

    Posted 12 years ago on Tuesday June 5, 2012 | Permalink
  3. Hi Joe,

    Can you provide a link to a page where this code is implemented?

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  4. Ahh... yes. I suppose that would've been a good thing to include :D

    Here's a form -- with the promo code xmember2012

    If you type that code in the promo code field, the total doesn't update. But if you refresh the page with the promo code still in the field, the total updates.

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  5. Hi Joe,

    The form total is only updated (and the gform_product_total function called) when a pricing field has been updated via user interaction. Your promo field is not a pricing field so typing within it does not trigger the form total update process.

    You can bind the change event of your promo field to update the form total like so:

    http://pastie.org/4040207

    Posted 12 years ago on Wednesday June 6, 2012 | Permalink
  6. Hi I am having a similar problem no matter what I put in the quantity field the total remains 0 and is not updated for the customer to see the total cost, It does however total on the email the forms send me, however as I have said about the cutomer sees a no update of the total.
    this is a link for a test form. Sorry this is probably something really stupid that I am not doing right (I am new at this).

    Curiouser and Curiouse , while the form does update perfectly on my iphone when I test it there, I doesnt send the form to "Entries or an email. The computer on the other hand wont update but will send the form with the price update displayed in "Entries"

    http://www.bodegacity.com/2012/06/02/coke-12-can-pack/

    Posted 12 years ago on Sunday June 10, 2012 | Permalink