Adding a Promo Code field to a Form

Hi Webflow experts!

I am working on a Free Trial landing page for my company, and we want to be able to include Promo Codes that people will receive from different marketing campaigns.

However, I don’t know how to go about this so that if someone enters an incorrect Promo code, we can display a “Not a valid promo code” error message. Likewise, we would need to maintain an up-to-date database of the valid promo codes to allow for a successful form submission.

Has anyone done this before? I assume it can only be done with custom code.

I would love to hear your experience and insights!

Best,
Sarah


Here is my site Read-Only: Webflow - TUVU

hi @sarahmmmiller it is fairly complex task to build with lots of preparations such choosing suitable DB, create DB design (tables, functions, queries etc. to be this system suitable to handle many different cases etc. You will need DB to make it work as IMO CMS is not suitable for such system to build.

Good luck

Are you just trying to verify the promo code, and then ( if valid ) submit the form normally using Webflow’s form submit?

If so, I’d probably build this as-

  • Airtable to store the promo codes
  • Make/Integromat to provide a simple webhook-based API
  • Client-side JS to call the webhook, process the response, and manage the form UX ( submit, error message, etc. )

There are a lot of other details here, like are the promo codes one-off, or do they have expiry dates, etc. But otherwise, this isn’t hugely complex to build.

Not sure about this statement but …
:thinking:

Yes, but what are you trying to accomplish with this?

What happens after someone enters a valid promo code? Does it unlock gated access or do something else? If so, what?

here is VERY SIMPLIFIED principle

TABLE CLIENTS

user_id name email
NUM (PK) TEXT TEXT

TABLE CAMPAIGNS

campaign_id name start_date end_date
NUM (PK) TEXT DATE DATE

TABLE PROMO CODES

id promo_code campaign_id is_used user_id access_start access_end
NUM TEXT NUM (FK) BOOLEAN NUM (FK) DATE DATE
  1. check if promo code from input field from client exist
  2. check if promo code has been used
  3. add client to DB and mark code as used
    3.1 manage scenarios when client already exist in DB but would like to use promo code from another campaign
    3.2 manage scenarios to avoid user use several promo codes for identical campaign
  4. check if promo code is still valid (access period is not over date)
    4.1. you need to make a decision on how to manage access_end when the user signs eg. the last day of the campaign etc.
    4.2. this should be run every day at noon (considering you have to deal with TZ and DTS if campaigns will be runinin internationally)

You would need to consider proper error handling, data validation, and securing the database to prevent malicious activities. Additionally, you may need to adjust the queries based on the specific database system you are using (e.g., MySQL, PostgreSQL, etc.).

on paper, it looks simple but in reality, it is IMO a bit more complex to make it correctly (security - expenses - speed) than we think.

using Meta or Zappier can become quite expensive depending on how many codes and campaigns you will run at the same time.