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.

Validate a coupon and/or discount code

  1. I have a WP blog that uses Gravity Forms with the PayPal plugin to perform a registration with payment for an event.

    We are doing to have a database of several hundred coupon codes (think Groupon). I want to have the registrant enter the coupon code and have it be verified against our database in order to provide them with the price associated with the code and have that price show up in their 'total' field. This same functionality would apply if they entered a 'group' code (for select groups that we are working with).

    Date would be in this format:
    Price - Code
    $55 - KidsGroup
    $65 - ChurchGroup
    $55 - 3883004823984
    $55 - 3994829284829
    $55 - 3699885702028
    We would need the system to check the group/code number and then feed back the price so that the total field shows the correct price.

    I tried to search the support forums thoroughly before posting this, so I apologize if it is a duplicate.

    Posted 10 years ago on Monday April 2, 2012 | Permalink
  2. I want to know the same, can you please reply?

    Posted 9 years ago on Friday September 21, 2012 | Permalink
  3. @tinuzzo, exactly what are you trying to do? We have code to match a number from a database or a number from a list in a text file. Or, if you have just a few numbers, they can be added to your function directly. We need to know exactly what you want to do. Thanks.

    Posted 9 years ago on Saturday September 22, 2012 | Permalink
  4. Hi Chris, I am trying to use the new Facebook Offers.
    I need to enter the URL where the coupon can be redeemed (my signup gravity form) and Facebook fans coming from the offer will need to enter the coupon and have the discount applied to their final checkout amount. So there's just one coupon code, that should be valid for anyone knowing it.

    This is the screenshot of the 2 fields I have to enter:

    I use cart66 for processing and a gravity form for gathering the info.

    How can I do this right?


    Posted 9 years ago on Saturday September 22, 2012 | Permalink
  5. OK, so it's a secret code to get the discount, and the code is always the same, and anyone entering it gets the discount. Is that correct?

    You want to use the gform_validation hook:

    You will compare the value input by the visitor to the value you hard code into your function. If there is a match, you don't return a validation error (i.e. the code was correct.) If the code does not match, you return a validation error.

    Give that a try and let us know how it goes. If you get stuck, be sure to post the URL to your form, and the code you are using for validation. Thank you.

    Posted 9 years ago on Sunday September 23, 2012 | Permalink