1

I've installed msp-recaptcha-2.0.0.0 in my Magento 2.2.6 installation and all works fine except for a glitch on the Checkout page.

On the Checkout page customers first see the "Review & Payments" section which contains an "Email Address" field. The email field has a listener which checks whether an entered email address belongs to an existing customer. If yes, a hidden Password field is made visible and we see the text "You already have an account with us. Sign in or continue as guest." and a Login button. However the reCaptcha widget is NOT displayed. Thus it is impossible to log in from here as the error message "Incorrect reCaptcha" always results.

In the top right corner of the Checkout page there is a "Sign In" popup which DOES contain the reCaptcha widget and works properly.

The MSP reCaptcha extension includes code to use the reCaptcha widget in the in-line Login case, but it's not working. Any workaround or solution would be really appreciated. After many hours I still cannot make it work. Thanks.

  • I saw a similar thing happen in a theme. The problem was how the layout XML had been used to override the template files used by block logic. If the MSP recaptcha extension overrides any template logic which renders markup for the login phtml I would focus your attention on that. Have you tried using luma theme to confirm it's not a theme issue rather than an extension issue? – Dominic Xigen Aug 6 '19 at 22:22
1

I finally tracked this down. I discovered the the Checkout process is dynamic and can consist of several steps, such as "Shipping" and "Review & Payments" etc. The exact sequence a customer sees will depend on specific product attributes. For example, for a product without weight, the Checkout page goes straight to "Review & Payments". If a product does have weight, the Checkout page starts at the "Shipping" step.

The MSP extension provided 2 block layouts for the Checkout page in the file

vendor/msp/recaptcha/view/frontend/layout/checkout_index_index.xml

Those corresponded to the shipping-step and authentication (pop up) page layouts, as follows:

checkout.steps.shipping-step.shippingAddress.customer-email.msp_recpatcha
checkout.authentication.msp_recpatcha

These worked fine as long as cart items had weight (and Checkout started on the "Shipping" step). The bug was that a layout for the billing-step was missing:

checkout.steps.billing-step.payment.customer-email.msp_recpatcha

This meant if you got to Checkout with items that did not have weight, you were unable to do an in-line login because the reCaptcha widget was missing. When this was added to the page layout, then the reCaptcha widget code was generated correctly by KnockOutJS in all 3 cases:

  1. reCaptcha in the Checkout page "Sign In" pop up
  2. reCaptcha in the in-line login on the Shipping step
  3. reCaptcha in the in-line login on the Payment step

In addition to checkout_index_index.xml, the associated change was also made to

vendor/msp/recaptcha/Block/LayoutProcessor/Checkout/Onepage.php

Hope this helps others to get MSP reCaptcha working correctly in all Checkout page scenarios.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.