• Resolved stepfaul

    (@stepfaul)


    Hi, I have been optimising my site and it seems that the reCAPTCHA integration in the plugin is causing reCAPTCHA to load on all Product pages (even though I have not configured any payment options on the product pages) and show a reCAPTCHA terms and privacy icon at the bottom of the page, can this be disabled on the Product pages or site wide at all?

    After performing various Google Page Speed tests it turns out that Google reCAPTCHA is actually quite nasty and negatively impacts the page score due to the way the reCAPTCHA scripts are loaded.

    For my Contacts Forms integration I have made the switch from reCAPTCHA to Cloudflare Turnstile which is free and does not negatively impact page loading times like reCAPTCHA does.

    Don’t get me wrong the reCAPTCHA integration has indeed stopped the card testing attacks we were seeing but is now impacting the speed of our product pages.

    Kind regards

    Steve

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Syde Jamie

    (@jamieong)

    Hi,

    Thank you for reaching out to us, we are here to help.

    The plugin enqueues reCAPTCHA scripts on product pages because it renders the v2 container and prepares for potential express checkout buttons.

    To disable reCAPTCHA on Product pages only, you can add this code to your theme’s functions.php or use a simple code snippet plugin:

    add_action('wp_enqueue_scripts', function() {  
    if (is_product()) {
    remove_action('wp_enqueue_scripts', array(
    WC()->integrations->get_integration('ppcp-recaptcha'),
    'enqueue_scripts'
    ));
    }
    }, 9);

    Since you had card testing attacks, we would suggest keeping the reCAPTCHA as it protects the PayPal REST endpoints. Disabling reCAPTCHA on product pages won’t affect checkout protection – it will still be active on cart and checkout pages where actual payment processing occurs.

    Let us know if you have further questions.

    Best Regards,
    Jamie

    Thread Starter stepfaul

    (@stepfaul)

    Hi @jamieong,

    Thank you for responding so quickly, unfortunately after adding the code to the bottom of my themes functions.php and clearing all caches the reCAPTCHA is still appearing on the Product pages.

    /* Disable WooCommerce PayPal Payments reCAPTCHA on Product Pages **/
    add_action('wp_enqueue_scripts', function() {
    if (is_product()) {
    remove_action('wp_enqueue_scripts', array(
    WC()->integrations->get_integration('ppcp-recaptcha'),
    'enqueue_scripts'
    ));
    }
    }, 9);


    ?>
    Plugin Support Syde Jamie

    (@jamieong)

    Hi @stepfaul ,

    Thank you for the feedback. This should work:

    add_action('wp_enqueue_scripts', function() {  
    if (is_product()) {
    wp_dequeue_script('ppcp-recaptcha');
    wp_dequeue_script('ppcp-recaptcha-handler');
    }
    }, 20);

    If you need to remove for Cart page too, you can use this:

    add_action('wp_enqueue_scripts', function() {    
    if (is_product() || is_cart()) {
    wp_dequeue_script('ppcp-recaptcha');
    wp_dequeue_script('ppcp-recaptcha-handler');
    }
    }, 20);

    Let us know if that resolves the issue for you.

    Best Regards,
    Jamie

    Thread Starter stepfaul

    (@stepfaul)

    Thanks @jamieong,

    That first snippet has done the job perfectly! Thanks again for the great support as this is the second time you have provided a solution.

    Steve.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.