• Resolved kongb

    (@kongb)


    Hello,
    I am attempting to set up Stripe in WooCommerce using your plugin, however, I am getting the error: ‘ReferenceError: Stripe is not defined’ on the checkout page. In the Google Dev. console the error is described as follows:

    Uncaught TypeError: Cannot read properties of null (reading 'elements')
        at t.wc_stripe.BaseGateway (wc-stripe.min.js?ver=3.3.15:1:553)
        at new t (credit-card.min.js:1:43)
        at credit-card.min.js:1:9055
        at credit-card.min.js:1:9061

    I have read similar threads on here suggesting it may be a cache problem. However I haven’t been able to solve it via these threads. I am using the Breeze cache plugin and also have the Cloudways Varnish activated on the site. As well, I am using Autoptimize for minifying css and js.

    Any help is much appreciated

    Best,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Regarding Autoptimize; make sure the “also optimize cart/ checkout”-option is off?

    Plugin Author Payment Plugins

    (@mrclayton)

    @kongb check to see if any of those plugins provide an ability to exclude external scripts from async loading or deferred loading.

    You’ll want to add js.stripe.com to the list of excluded scripts.

    Kind regards

    Thread Starter kongb

    (@kongb)

    So I have found out what is causing the error. It is a conflict between your plugin and the One Trust Cookie Compliance Service (onetrust.com). This service is integrated with my website via the below function in my child theme’s function.php file. The function inserts One Trust script tags into the top of the <head> section in the header.php file.

    add_action('wp_head', 'custom_head_function', -9999999);
    function custom_head_function(){
    ?>
    
    <!-- OneTrust Cookies Consent Notice start for xxx.com -->
    <script type="text/javascript" src="https://cdn.cookielaw.org/consent/234de168-94c9-4781-9a67-189fcd4a57af/OtAutoBlock.js" ></script>
    <script src="https://cdn.cookielaw.org/consent/234de168-94c9-4781-9a67-189fcd4a57af/otSDKStub.js"  type="text/javascript" charset="UTF-8" data-domain-script="234de168-94c9-4781-9a67-189fcd4a57af" ></script>
    <script type="text/javascript">
    function OptanonWrapper() { }
    </script>
    <!-- OneTrust Cookies Consent Notice end for xxx.com -->
    
    <?php
    };

    I wonder if you would consider making your plugin compliant with the One Trust Cookie Consent Service?

    Plugin Author Payment Plugins

    (@mrclayton)

    @kongb

    My understanding is that plug-in has the ability to exclude certain scripts. Are you able to add our script to the list?

    Is this a public plugin and if so can you send a link to their WordPress page?

    Kind regards

    Thread Starter kongb

    (@kongb)

    Hello,
    Thanks for your quick replies. It is a cloud-based service:
    https://www.onetrust.com/products/cookie-consent/

    When I login to One Trust I don’t see an option to exclude scripts but I will try to contact them with your information above and see if they can add them to an exclusion list backend for my account..

    Best,

    Thread Starter kongb

    (@kongb)

    Hello,
    I have solved the issue via OneTrust Cookie consent. It was the auto-blocker that created the conflict.

    Best,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘ReferenceError: Stripe is not defined’ is closed to new replies.