• Resolved Jason

    (@galapogos01)


    Hi guys,

    I run this plugin along with the excellent Query Monitor plugin to watch performance & loads times. It shows script includes and other useful things including errors.

    The Braintree plugin is including a braintree-js-data-collector script which is dependent on braintree-js-client, but braintree-js-client is only included on pages which include the braintree payment functionality (eg. Cart & Checkout). This results in an error being thrown on most site pages including PDP etc.

    Specifically, woocommerce-gateway-paypal-powered-by-braintree/includes/class-wc-gateway-braintree-credit-card.php

    128 public function enqueue_gateway_assets() {
    129
    130 // advanced/kount fraud tool
    131 if ( $this->is_advanced_fraud_tool_enabled() ) {
    132
    133 // enqueue braintree-data.js library
    134 wp_enqueue_script( 'braintree-js-data-collector', 'https://js.braintreeg ateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/data-collector.min.js', array( 'braintree-js-client' ), WC_Braintree::VERSION, true );

    I have advanced fraud enabled. Is braintree-js-client required for the advanced Fraud functionality to work or should braintree-js-data-collector not be included on PDP?

    If I remove the dependency I do not get any console errors.

    When can your devs assess & release a fix for this?

    • This topic was modified 8 months, 3 weeks ago by Jason.
    • This topic was modified 8 months, 3 weeks ago by Jason.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello Jason

    Thank you for contacting WooCommerce support.

    I understand that you are experiencing issues with the braintree-js-data-collector script on pages that do not include the Braintree payment functionality, such as product detail pages (PDP), due to a dependency on braintree-js-client which is only loaded on pages with the cart and checkout.

    You’ve mentioned that this is causing an error, and you’re wondering if braintree-js-client is necessary for advanced fraud functionality, or if the data collector script should not be included on the PDP.

    Before we dive into more details, could you please share some screenshots of the Query Monitor plugin with me for better understanding?
    After that, I will try to recreate the scenario on my end and see if I get the same results.

    I look forward to your response. ??

    Best regards.

    Thread Starter Jason

    (@galapogos01)

    Hi Zubair,

    See https://i.imgur.com/05nksdU.png

    Thanks,

    Jason

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello Jason

    Thank you for your reply.

    I appreciate your efforts for collecting and sharing all the details.

    While I consult the devs about this potential issue, could you clarify one thing?

    When you said “If I remove the dependency I do not get any console errors“, what steps did you take to remove the dependency?

    I will include this information in my report for a better understanding of the problem at hand.

    I look forward to your response. ??

    Best regards.

    Thread Starter Jason

    (@galapogos01)

    I modify line 134 of the plugin shown in my code excerpt above to remove the dependency.

    ?? hey @galapogos01

    Thank you for reaching back, clarifying things further.

    I went ahead with testing this, with a test site of mine, using the latest version of the Braintree for WooCommerce Payment Gateway plugin, unmodified, and everything worked as expected; without any errors reported.

    Below, I am attaching a screenshot, for reference.

    To clarify, are you able to reproduce this, with only the following plugins active on your site, or otherwise?

    Direct link to image: https://snipboard.io/pWnymZ.jpg

    I hope this is helpful! We look forward to your response. In the meantime, please let us know if you have any further questions or concerns.

    Thread Starter Jason

    (@galapogos01)

    You need to enable advanced fraud tool, and the error will only occur on a product page when you have paypal “buy now on product pages” disabled.

    Plugin Support Sean O))) a11n

    (@seanomattic)

    Hey @galapogos0,

    Thanks for your diligence in reporting this issue, our developers have identified that this is a bug which will be addressed in a future release. I can’t supply an exact ETA at this time, but as you mentioned, it’s a quick fix, so it shouldn’t be a long wait.

    All the best!

    Thread Starter Jason

    (@galapogos01)

    Thanks guys, would it also be possible to fix the issue with vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.min.css referencing the non existent file sv-wc-payment-gateway-payment-form.min.css.map ? Causes unnecessary 404’s which impacts some firewalls.

    Thanks,
    Jason

    Plugin Support Sean O))) a11n

    (@seanomattic)

    Hi Jason,

    Thanks for the reply. I’m not 100% certain what this is related to, but it seems to be this GoDaddy script: https://github.com/godaddy-wordpress/wc-plugin-framework.
    If that’s the case, you should contact the plugin developers for a fix for this one.

    Thanks!

    Thread Starter Jason

    (@galapogos01)

    Que?

    I am talking about a second problem in the Braintree plugin. I provided a reference to the file which is broken, it’s a file from your plugin. Nothing to do with GoDaddy.

    Plugin Support Sean O))) a11n

    (@seanomattic)

    Hi Jason,

    Gotcha, thanks for the clarification! I’ll forward this information to the developers as well.

    Best,

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Broken script dependencies leads to error on PDP’ is closed to new replies.