Get the #1 Action Upsell App 💰 Over $75m in upsells!Add to Shopify

Increase revenue 50% 💰 with upsells!Get App

How to easily add basic Captcha protection on your Shopify blog

Captcha protection
SellUp Shopify Upsell App

Last Updated on January 7, 2022 by LAUNCHTIP

Since Shopify allows store owners to run built-in blogs, it’s easier for businesses to interact with their customers. But like any other blog, the Shopify blog is also subjected to the nuisance of spam bots. This where a basic Captcha protection is needed. 

Here’s how you can add basic captcha protection to your Shopify blog. 

How to add Captcha protection

The method requires a bit of coding, but it will keep bots away, so it’s worth a shot. 

  • Go to Themes and then to Template Editor 
  • Select article.liquid
  • Add the following code to the file 
<script type="text/javascript">
     $(document).ready(function() {
   	 var n1 = Math.round(Math.random() * 10 + 1);
     	 var n2 = Math.round(Math.random() * 10 + 1);
   	 $("#question").val(n1 + " + " + n2);
  	 $(".comment-form").submit(function (e) {
          	 if (eval($("#question").val()) != $("#answer").val()) {
                     $("#answer").css('box-shadow', '0px 0px 7px red');


  • When you come to the end of the form, add this code before submitting: 
        <br/>How much is: <input type="text" disabled="disabled" id="question"/>
        <br/>Answer:* <input type="text" id="answer"/>


Finally, save the changes, and the captcha code will be added to your blog. 

Benefits of Captcha protection

Captchas are useful in keeping hackers out of your online services, preventing them from submitting nefarious requests. Additionally, they keep hackers from spamming the news content with links to harmful websites or dodgy comments. 

Captcha also increases the security of online shopping for your customers and builds brand trust. Most importantly, it enhances the integrity of your online polls since the bots can’t send false responses. 

Limitations of the method 

Although this method is a useful way to keep bots away, it assumes the following things: 

  • The spambot is not familiar with the post URL 
  • The spambot fills the data instead of posting to the post URL 
  • JavaScript is being used for spamming
SellUp Shopify Upsell App

More To Explore