Donation Form With Giving Levels, Variable Amounts, and Choice of Subscription?

LucyILucyI Member
I have used the Donation Form example to implement a form that allows users to choose preset amounts or an amount they choose. Works fine, but we need a bit more complexity.

1. We need the label text from the checked radio button to display in the cart, because it contains the title of the giving level and without it only an amount displays in the cart. Wondering if product options would accomplish this, or some kind of data attribute?

2. We need to add an option to make the donation a recurring monthly or annual one.

Possible?
Comments
  • fc_marijafc_marija FoxyCart Team
    Hi @LucyI -

    Thanks for reaching out. Those things sound doable, and we're happy to help you figure out what you need to do. Do you happen to have a publicly available URL to the page you're working on? You can use the whisper feature on the forum if you'd rather not share it publicly. Otherwise, you can share the relevant portion of the page that encompasses the Add to Cart. This will help us figure out how to modify what you already have.

    Look forward to hearing from you.

    -Marija
  • fc_adamfc_adam FoxyCart Team
    edited July 19
    @Lucyl,

    Thanks for whispering a link there - I see you're using our donation form snippet to allow for a customer to select a donation level, or specify a custom "other" amount. To be able to pass in the level of support the customer has selected as well - it'll require a slightly different approach, using our product option modifiers to set the price, and allowing the selected value to pass through as well. I'll whisper you some updated code for your form to show how that could be achieved.

    In terms of the subscription option - you can achieve that by including a set of radio inputs that are for the sub_frequency, with the different frequencies you want to support. To allow for a one-time payment, the sub_frequency value just needs to be blank:
    <label for="frequency_once"><input type="radio" name="sub_frequency" id="frequency_once" value="">Just this once</label>
    <label for="frequency_monthly"><input type="radio" name="sub_frequency" id="frequency_monthly" value="1m">Monthly</label>
    <label for="frequency_yearly"><input type="radio" name="sub_frequency" id="frequency_yearly" value="1y">Annually</label>
Sign In or Register to comment.