SEO, AdWords, affiliates, advertising, and promotions
Hello, I would like to know if there is a way to limit access to a form after it has been submitted by a certain number of people, to stop accepting submissions or automatically block access to the page.
I am going to create a discount and I only have 20 coupons, but 50 people have entered and signed up on the form. Therefore, I want to limit it to only the first 20.
@Roger_vita Hey To limit form submissions, use an app like Mechanic or Custom Forms that supports submission limits. Set it to cap at 20 entries, after which the form will auto-close or redirect users. This will help control coupon availability
To limit form access after a certain number of submissions, you can use custom code or third-party form builders like Typeform or JotForm, which allow setting submission limits; configure the form to close automatically once 20 people have submitted, or use conditional redirects to a “Closed” page once the limit is reached.
Could you help me with the custom code? I don’t understand much about programming.
Hi @Roger_vita
Yes, you can limit form submissions to only a certain number of people. Here are some ways to do it, depending on the platform you're using for your form:
Google Forms doesn’t natively support limiting responses, but you can add a custom script to close the form after a set number of responses. Here’s how:
In the Google Sheets file, click Extensions > Apps Script and paste the following code:
function limitResponses() {
const maxResponses = 20; // Set the maximum number of responses
const form = FormApp.openById("YOUR_FORM_ID"); // Replace YOUR_FORM_ID with your form's ID
const responses = form.getResponses().length;
if (responses >= maxResponses) {
form.setAcceptingResponses(false);
}
}
This script will automatically close the form once it reaches 20 responses.
Many form builders have built-in settings for limiting the number of submissions. Here are a few that support this feature:
In each of these tools, you'll typically find an option in the settings under Limits or Response Limits.
If you're embedding a form on your website and you have coding experience (or a developer’s help), you can add JavaScript to count the number of submissions and disable the form when the limit is reached.
Here’s a basic outline:
This approach can give you complete control, but it requires technical setup.
If you’re not comfortable with scripts, you can use an automation tool like Zapier or Integromat to manage form responses:
If you need an easy-to-implement solution, using a form builder like JotForm or Typeform would be the quickest way. If you’re using Google Forms, the script method above will work well but may require a bit more setup.
Let me know if you’d like further help with any specific tool!
Best regards,
Daisy
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025