Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
My email sign up block on a build MetaObject Template I have built it not working. I am testing the page and I am not able to progress once I go through the CAPTCHA phase of the sign up. I have gone through all of the trouble shooting suggestions that the sidekick has suggested.
Hi,
Email signup forms getting stuck after CAPTCHA completion is a common issue with custom MetaObject templates. Here are the most likely causes and solutions:
The necessary code for CAPTCHA functionality is included through the content_for_header object. If a merchant has CAPTCHA enabled, but the content_for_header object isn't present, then the CAPTCHA functionality won't be present.
Solution 1: Check content_for_header
Solution 2: Fix Form Action & Attributes If your theme uses custom forms, then make sure that the above attributes are included so that your forms are compatible with CAPTCHA functionality.
Your form should look like this:
{% form 'customer' %} <input type="email" name="contact[email]" placeholder="Email address" required> <input type="hidden" name="contact[tags]" value="newsletter"> <input type="submit" value="Subscribe"> {% endform %}
Solution 3: Force CAPTCHA Wireup In some scenarios, it might be necessary to force CAPTCHA wire up to a form. For example, the form might be indirectly populated and submitted, so the default behavior of wiring CAPTCHA on user interaction never happens.
Add this to your form:
<form data-shopify-captcha="true" action="/contact#contact_form" method="post">
Or use Javascript:
window.Shopify.captcha.protect(document.querySelector('#your-form'));
Check if CAPTCHA is Working: You can verify that hCaptcha is correctly wired to your form by using your browser's network dev tools while the form is being submitted. Open dev tools on the Network tab. Fill in and submit the form. In the browser's dev tools, inspect the payload of the POST request to the server. Ensure that the h-captcha-response field is present and contains data.
If the above doesn't work immediately:
Try this simplified form in your MetaObject template:
{% form 'customer' %} <input type="email" name="contact[email]" required> <input type="hidden" name="contact[tags]" value="newsletter"> <button type="submit">Subscribe</button> {% endform %}
If this works, then gradually add back your custom styling and JavaScript.
Pro tip: Recent Shopify updates to CAPTCHA protection have caused some newsletter signup forms to stop working, so you may need to update your form structure to match current requirements.
Let me know which solution works for you, or if you need help with the specific code implementation!
Cheers!
Shubham | Untechnickle
Helping for free: hello@untechnickle.com
Don't forget to say thanks, it'll make my day - just send me an email!
Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App