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.

Adding taxes to 'total'

  1. Derk
    Member

    I've kept an eye on some discussions regarding this subject, but to this day ive not seen something i can use!

    I want to know how i can add percentage (tax .. for example 19%) to the total of my form, wich would would look something like this: € 500 (€ 595 including tax).

    How can this be achieved?

    Posted 13 years ago on Wednesday August 3, 2011 | Permalink
  2. This isn't currently possible as a built in feature, it's only possible via custom code.

    Here is a forum thread that discusses how to add surcharges/taxes/etc. using custom code:

    http://www.gravityhelp.com/forums/topic/adding-paypal-transaction-fee

    Posted 13 years ago on Wednesday August 3, 2011 | Permalink
  3. I got this work nicely on one form but what if you have more than one form you'd like this work on? It doesn't work if you add another form into 'add_action' or 'add_filter'.

    Posted 13 years ago on Monday September 5, 2011 | Permalink
  4. Can you post your code to pastebin.com or pastie.org? Thank you.

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  5. Here it is http://www.pastie.org/2490917

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  6. On line 2 and line 16 you have form 6 specified in your filter name. You can duplicate these code blocks and change the 6 to your additional form ID, to apply to another form. But if the code is exactly the same, you probably want to change the filter names to these:

    [php]
    add_action('gform_pre_render', 'add_surcharge_js');
    [php]
    add_filter("gform_product_info", "add_surcharge", 10, 3);

    Then in the code below, add a condition to check for multiple form ids. Something like this:

    http://pastebin.com/5vPsHQXW

    I used an array for form IDs with 6 and 9. Change the 9 to your second form ID on both line 6 and line 28. You can add more form IDs in the array as well if you need to apply this code to more forms.

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  7. Thanks for your reply. I'll be sure to use this on my other form. However, I've just tested my first form using a sandboxed PayPal and while the 3.9% was added on the total it was not carried across to PayPal. It displays correctly in the notification email. Can you spot anything?

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  8. I didn't really look at the code to see if it would work, just to see that it was without syntax errors.

    When you mentioned previously that you had gotten it to work, you had not actually sent the transaction to the PayPal sandbox? It just "worked" on your form? Or it does not work now after modification?

    Do you use just products or products and options in your form?

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  9. Once the functions had been put in the functions.php file in my theme I noticed the total had the percentage added and when I submitted the form without implementing PayPal it emailed me the correct total. I assumed the form would send the correct total through to PayPal when I'd set that up but it didn't.

    I've used products with options in my form. The form can be viewed here http://www.iiirg.org/members/payment/

    Your help is much appreciated.

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  10. Hi Ryan,

    Are you using a subscription type payment feed? If so, currently with the PayPal Add-on for subscription feeds, you can only select a single product for the subscription total. I've sent an updated version of the PayPal Add-on to your member email which will allow you to select a "Form Total" option. This will include any custom products (aka your tax product) added via the gform_product_info hook.

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  11. It worked fine. Thanks very much for your help and the speedy responses. Much appreciated.

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink
  12. Glad we could help. :)

    Posted 13 years ago on Tuesday September 6, 2011 | Permalink

This topic has been resolved and has been closed to new replies.