Add a custom fee to total donation total on checkout

kdawg1981kdawg1981 Member
in Help edited July 2
We are are setting up a donation form page and on the page we have a drop down box that will ask the customer if they wanted to pay the processing fee. What I'm looking for help on is if I need to define that processing fee in the configuration or is there something within the wikipages that can help me with this. Below is the HTML form we have put together so far. Maybe I'm missing something... Any help would be greatly appreciated.
Comments
  • fc_adamfc_adam FoxyCart Team
    @kdawg1981,

    Good question. There are a few different ways that a fee could be added onto the transaction. Could I confirm with you - how is that fee calculated? Is it a specific amount or percentage? Or is it dependant on specific factors? If you could clarify that we can provide some details on approaches you could take.
  • kdawg1981kdawg1981 Member
    edited July 3
    @fc_adam

    On the form that we have, we have an option that asks the customer if they want cover the 3% processing fee. So if the customer wants to donate 100 dollars and they want to include the 3% it would calculate to $103 dollars total.
    So here is the code that we have so far set up.
    <div>
    <form accept-charset="utf-8" action="https://cyas.foxycart.com/cart" method="post">
    <input name="name" type="hidden" value="Donation" />
    <input name="quantity_max" type="hidden" value="2" />
    <input name="empty" type="hidden" value="true" />
    <input name="cart" type="hidden" value="checkout" />
    </div>

    <div>
    <label for="price">Donation Amount:</label> $
    <input name="price" required="" type="text" value="" id="price" style="width: 50px;" />
    </div>
    <div>
    <label for="sub_frequency">Donation Type</label>
    <select name="sub_frequency">
    <option value="1m">Monthly (Best)</option>
    <option value="1Y">Yearly</option>
    <option value="">One-time</option>
    </select>
    </div>
    <div>
    <label for="cover_processing_fee">Would you like to cover the 3% processing fee?</label>
    <select name="Cover Processing Fee" id="cover_fee">
    <option value="No">No</option>
    <option value="Yes">Yes</option>
    </select>
    </div>
    <input name="Processing Fee" type="hidden" value="" id="fee" />
    <div>
    <input type="submit" value="Next" class="submit" />
    </div>
    </form>
  • fc_adamfc_adam FoxyCart Team
    @kdawg1981,

    Thanks for confirming!

    Looking at your store, I see you're applying a tax currently for the 3% processing fee. That is a good approach you could continue with. To make it only apply if the customer elects to pay that, you could add an additional category to your store. You'd then set the default category to not apply the tax, but the new category, configured in the same way as your existing default category, would apply the tax.

    In your add to cart form, you would edit the "Cover Processing Fee" select element's "Yes" option to add a product option modifier which changes the category. That would look like this:
        <select name="Cover Processing Fee" id="cover_fee">
    <option value="No">No</option>
    <option value="Yes{y:NewCategoryCode}">Yes</option>
    </select>
    You would need to update the NewCategoryCode value there to be the code of the new category you create in your store which has the tax applying.

    You can also remove the hidden text input for the processing fee.

    That should get you a set up where the customer can elect to pay the processing fee or not. Let us know if you have any questions!
  • kdawg1981kdawg1981 Member
    @fc_adam

    Thank you so much for the advice and the help. This recommendation helps and is working for us now. Appreciate it much.
  • Hello! I'd like to do the exact same thing with our store: Customer has the option to pay the credit card processing fee (3%) by selecting YES or checking a box.

    Store: cusf.foxycart.com/cart
    Donate page: http://cuschoolsfoundation.org/donate/
    cover_fee is the category code, which adds a 3% tax

    Setting up a category seems to be the way to go, but I haven't quite figured out the coding part. Looking at the example above, it looks like it should go something like this
    <div>
    <form accept-charset="utf-8" action="https://cusf.foxycart.com/cart" method="post">
    <label for="cover_processing_fee">Would you like to cover the 3% processing fee?</label>
    <select name="Cover Processing Fee" id="cover_fee">
    <option value="No">No</option>
    <option value="Yes{y:cover_fee}">Yes</option>
    </select>
    </div>
    <input name="Processing Fee" type="hidden" value="" id="fee" />
    <div>
    <input type="submit" value="Next" class="submit" />
    </form></div>
  • fc_adamfc_adam FoxyCart Team
    @davidmoore20,

    That's pretty much exactly right - except you wouldn't need the hidden input for "Processing Fee". You'd also want need to have some way for the customer to specify their donation within the form as well. As you've already got forms that allow the customer to donate - you would just insert this code into those forms that you want the customer to be able to cover the processing fee for:
    <label for="cover_processing_fee">Would you like to cover the 3% processing fee?</label>
    <select name="Cover Processing Fee" id="cover_fee">
    <option value="No">No</option>
    <option value="Yes{y:cover_fee}">Yes</option>
    </select>
Sign In or Register to comment.