Set up Google reCaptcha or Basic Captcha in OpenCart 3.0+ and

Now in OpenCart 3.0 and version, it is very easy to setup google reCaptcha in multiple pages. Forms of Opencart that google reCaptcha supported are  Register, Guest Checkout, Reviews, Returns, and Contact.

Basic Captcha:

  • Go to Extensions >> Extensions >> In Choose the extension type >> Captchas (2)
  • Now click the green button to install the Basic Captcha
  • Click the blue edit button of Basic Captcha
  • Choose Enabled from the status
  • Click save and you are set

Google reCaptcha:

  • Go to Extensions >> Extensions >> In Choose the extension type >> Captchas (2)
  • Now click the green button to install the Google reCaptcha
  • Click the blue edit button of Google reCaptcha
  • How to set it up in Google reCaptcha admin?
    1. Go to (login with Gmail account if not) and enter your Label(Any name) and domain name(website URL). New style with reCAPTCHA v3:
      google recaptcha for opencart
      After entering the label select the reCAPTCHA type “reCAPTCHA v2” and then select

      Old style:

      google recaptcha for opencart
    2. When you click the register button, you will get the site key and secret key in the Keys tab. New style:
      google recaptcha for opencart
      Old style


      OpenCart site key and secret key of google reCaptcha
  • Enter the Site key and Secret key from the google reCaptcha page
  • Choose Enabled for the Status
  • Click save and you are set.

Activate in forms:

Go to Admin >> System >> Settings >> Edit the Store >>  Click on Option tab >> Near the bottom you will see the Captcha section :


Choose whichever captcha you want to show in the site and then click save.

Now go to contact us page:


If you get an error like:
ERROR for site owner: Invalid key type

error in google recaptcha for opencart

Then please check whether your domain is added correctly or not. Another problem is whether you are using reCAPTCHA v2 or not.

Let us know through comment or email at if you are having any issues.

Previous articleOpencart 3 OCMOD coding tutorial
Next articleWorkflow or markup to make hello world module – OpenCart Module Development


  1. Hi,

    Thanks for the sharing. I have an issue with OC After enabled with google recaptcha and applied to the contact form but it doesn’t work. I can see the google captcha “I am not Robot” appear but it simply doesn’t work and bypass it no matter you have authenticating it or not. Do you have any idea? I have checked the catalog/controller/information/contact.php the google reCaptcha seems no code applying in there. Can you help please?



    • Hi @Paul,

      In catalog/controller/information/contact.php you can find the code implemented in the validate method.
      protected function validate() {
      if ((utf8_strlen($this->request->post[‘name’]) < 3) || (utf8_strlen($this->request->post[‘name’]) > 32)) {
      $this->error[‘name’] = $this->language->get(‘error_name’);
      if (!filter_var($this->request->post[’email’], FILTER_VALIDATE_EMAIL)) {
      $this->error[’email’] = $this->language->get(‘error_email’);
      if ((utf8_strlen($this->request->post[‘enquiry’]) < 10) || (utf8_strlen($this->request->post[‘enquiry’]) > 3000)) {
      $this->error[‘enquiry’] = $this->language->get(‘error_enquiry’);
      // Captcha
      if ($this->config->get($this->config->get(‘config_captcha’) . ‘_status’) && in_array(‘contact’, (array)$this->config->get(‘config_captcha_page’))) {
      $captcha = $this->load->controller(‘extension/captcha/’ . $this->config->get(‘config_captcha’) . ‘/validate’);
      if ($captcha) {
      $this->error[‘captcha’] = $captcha;
      return !$this->error;
      Please verify yout secret key and site key again.

  2. Hello Rupak,

    Thanks for the reply. Yes I double checked I have all exact the same coding in the contact.php. Actually I refreshed the module modification and it works now. Not sure if were related but I am glad it is resolved. Thanks you for great help and excellent site.



Please enter your comment!
Please enter your name here