Can I change the price of a product based on their answer to a question?

  • Laurel_Ridge
    Asked on April 23, 2024 at 2:31 PM

    We are creating a form for people to pay for spaces at our annual community yard sale. The spaces cost different amounts depending on a condition: community members pay $25.00 per space, but our College students/staff/faculty only pay $20 per space. I have a yes or no question set up for someone to indicate if they are a community member or College student/staff/faculty. Is there a way to conditionally format it so that by selecting "yes" on that question, the price of the product drops to $20.00? I'm open to any suggestions you have. I watched the video linked at https://www.jotform.com/widgets/calculation but couldn't figure out how to apply that to my situation.

    Any help is appreciated.

  • Ericson_B JotForm Support
    Replied on April 23, 2024 at 3:10 PM

    Hi Laurel,

    Thanks for reaching out to Jotform Support. Unfortunately, we cannot conditionally adjust the prices of the products in the Product List. A workaround is to have two single-choice elements, assign a calculation value to each, and display the short texts based on the Yes or No options. We will then use User Defined Amount for your Square integration. Let me show you how:

    1. In Form Builder, select Add Form Element in the upper-left corner.
    2. In the Form Elements pane on the left, add 2 Short Texts.
    3. Select the Short Text's Gear icon to open properties.
    4. Scroll down and toggle Read Only.

    Can I change the price of a product based on their answer to a question? Image 1 Screenshot 70Next, set up an Update/Calculate field condition so that when your form filler selects one of the Yes or No options, the amount is assigned to each short text. 

    1. Go to Settings at the top.
    2. Select Conditions on the left.
    3. Add a new Update/Calculate Field condition.

    Can I change the price of a product based on their answer to a question? Image 2 Screenshot 81Set up two conditions as shown below, and make sure that both amounts are set to string (grey color).

    Can I change the price of a product based on their answer to a question? Image 3 Screenshot 92Then, set up a Show/Hide field condition so that when they select Yes or No, one of the short texts will appear along with the amount. You can refer to the condition screenshot above to see where to select the Show/Hide condition. Set up two conditions as shown below:

    Can I change the price of a product based on their answer to a question? Image 4 Screenshot 103Following that, we'll include a Form Calculation widget to get the amount of both fields. To hide the widget, right-click on it and select Hide. 

    Can I change the price of a product based on their answer to a question? Image 5 Screenshot 114 In the final step, we'll alter the Square integration to a user-defined amount and retrieve the pricing via the Form Calculation widget. 

    1. Select the Wand icon to open the integration settings.
    2. Go to Payment Type and select User Defined Amount.
    3. Next, click Get Price From and select Total (Form Calculation Widget)
    4. Click Save to save the changes.

    Can I change the price of a product based on their answer to a question? Image 6 Screenshot 125Here's my cloned form that you can test.

    Give it a try and let us know if you have any other questions.

  • Laurel_Ridge
    Replied on April 26, 2024 at 2:03 PM

    Thank you for this help. I'm stuck on this step: "Following that, we'll include a Form Calculation widget to get the amount of both fields. To hide the widget, right-click on it and select Hide. " Could you provide a screen shot of how to do that?

  • Neil JotForm Support
    Replied on April 26, 2024 at 2:34 PM

    Hi Laurel,

    Thanks for getting back to us. Sure, let me show you how to do that:

    1. In Form Builder, click on Add Form Element.
    2. Then, go to the Widgets tab.
    3. Search for Form Calculation and click or drag it to your form.

      Can I change the price of a product based on their answer to a question? Image 1 Screenshot 40
    4. After that, right-click on the widget and select Hide so it won't be visible on the live form.
    5. Then, click on the wand icon to open its settings.
    6. Click on Add Field and add both the Community members and College student/staff/faculty fields.
    7. Make sure to add a plus sign between them and click on Save.

      Can I change the price of a product based on their answer to a question? Image 2 Screenshot 51

    For the final step, you can refer to the steps given by my colleague above on how to change the payment type of the Square integration to User Defined amount and get the total pricing from the form calculation widget we've set up.

    After that, you should be getting the same result:

    Can I change the price of a product based on their answer to a question? Image 3 Screenshot 62

    You can also check the demo form here. Feel free to clone it to further test it. We have a guide here that you can check out on how to clone an existing form from a URL.

    Give it a try and let us know if you need more help.

  • Laurel_Ridge
    Replied on May 3, 2024 at 7:45 AM

    I seem to have set something up incorrectly with the calculations. It will calculate the number of spaces for our "College Student" option correctly, but for our "Community Member" option, it doesn't calculate anything. For example, some who marked "No" to being a student/faculty/staff and they enter that they want 5 spaces at $25, the calculation only shows they pay $25 instead of what should be $125. Any idea what I did wrong?

  • Eliza JotForm Support
    Replied on May 3, 2024 at 8:38 AM

    Hi Laurel,

    Thanks for getting back to us. When I cloned and tested your form, the same thing happened for me. After investigating it a bit, I found a solution. Let me show you how. But first, let's remove the calculation you have within your Form Calculation widget:

    1. In Form Builder, click on the Form Calculation widget and click on the wand icon.
    2. Remove the fields within the box.
    3. Click on Save.

    Can I change the price of a product based on their answer to a question? Image 1 Screenshot 60

    Next, let's set up Conditional Logic:

    1. Click on Settings in the orange navigation bar at the top part of the page.
    2. Go to Conditions, and click on Add Condition.
    3. Select Update/Calculate Field, and set the conditions as shown in the screenshot below/
    4. Click on Save.

    Can I change the price of a product based on their answer to a question? Image 2 Screenshot 71

    Then, let's add another set of conditions:

    1. Click on Settings in the orange navigation bar at the top part of the page.
    2. Go to Conditions, and click on Add Condition.
    3. Select Update/Calculate Field, and set the conditions as shown in the screenshot below/
    4. Click on Save.

    Can I change the price of a product based on their answer to a question? Image 3 Screenshot 82

    The screencast below shows how the conditions above are done:

    Can I change the price of a product based on their answer to a question? Image 4 Screenshot 93

    Check out the screencast below to see my results:

    Can I change the price of a product based on their answer to a question? Image 5 Screenshot 104

    You can also clone this Demo Form if you want.

    Give it a try and let us know if you need any other help.

 
Your Answer