Discount or Coupon Code on form? - Post ID 278327


Registered User
74 posts

Hi, is there a way to offer a discount or coupon code on the form? I'm using PayPal and can have items with prices but want a way to offer a discount off the total price before it sends the data to PayPal to process. For example if I had a text field and they typed in the promo code "10off" they would get $10 off or 10% off depending on how I set it up. Is this doable? Thanks.


Senior Advisor
17,801 posts
Online Now

Hi Mark, You can use the built in conditional controls to allow the discount. If using the conditionals I would use a regular expression to only allow the code to be entered then show a different set of prices.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Senior Advisor
17,801 posts
Online Now

Ok I check on this and that's not going to work with the built in conditionals. You could do an ajax call to your server to hide and show elements based on the correct code being entered. It would take a little adjusting to make sure it works with the formbuilders validation scripts but I thinks it's doable.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Senior Advisor
17,801 posts
Online Now

I may have a work around. Let me test.;)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Senior Advisor
17,801 posts
Online Now

Here's a quick example.
http://ericrohloff.com/coffeecup/ccforu … rms/10off/
code:10off
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Senior Advisor
17,801 posts
Online Now

This is not for S-Drive
1. Add a regular expression element to your form.

2. Paste this code into the RegEx: Custom option /(?:^|\W)(10off)(?:$|\W)/

3. Add a dropdown and name it discount.

4. Leave only one product option in the dropdown and set its text to 10off

5. Add the two product choice inputs to your form. One at reg price and the other 10% less.

6. Now set the conditionals for the two price inputs to look at the value of the dropdown to whether they show or not.

7. Export your form.

8. Now go the the myformname.html and delete the dropdown.
You'll be deleting all of this.
<div class="fb-item fb-100-item-column" id="item4">
<div class="fb-grouplabel">
<label id="item4_label_0" style="display: inline;">Enter discount</label>
</div>
<div class="fb-dropdown">
<select name="discount" id="item4_select_1" data-hint="">
<option id="item4_0_option" selected value="10off">
10off
</option>
</select>
</div>
</div>


9. Now change the regular expressions name value to discount. Mine was regex1
<div class="fb-item fb-100-item-column" id="item1" style="opacity: 1;">
<div class="fb-grouplabel">
<label id="item1_label_0" style="display: inline;">Enter code to get 10% discount</label>
</div>
<div class="fb-regex">
<input name="regex1" id="item1_regex_1" type="text" maxlength="254" placeholder=""
autocomplete="off" data-hint="" />
</div>
</div>

10. Now open the form.cfg.php and look for this line "validation_report" : "in_line". Your going to edit the code below it.

11. Look in the code and find the name value of your regular expression input. Change it to discount. Mine was regex1
It looked like this before editing.
{"regex1":{"label":"Enter code to get 10% discount","fieldtype":"regex","regex_config":"/(?:^|\\W)(10off)(?:$|\\W)/"}

Like this after editing
{"discount":{"label":"Enter code to get 10% discount","fieldtype":"regex","regex_config":"/(?:^|\\W)(10off)(?:$|\\W)/"}


12. Now look through that code for the name discount which is what your dropdown was named. It may look like this.
,"discount":{"label":"Enter discount","fieldtype":"dropdown","values":["10off"]}


13 Delete this line along with the comma that separates it from the other validations.
Save, upload and test.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
74 posts

Eric, thanks for looking at this today. I'll give it a try when I get back to the computer. This will help a lot.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.