Support » Plugin: WooCommerce PayPal Payments » Remove Scripts on Frontend

  • Resolved Zachary Elkins

    (@zacharyelkins)


    There are (3) scripts that run on the frontend, which I don’t think are necessary unless at checkout.

    woocommerce-paypal-payments/modules/ppcp-button/assets/js/button.js
    //www.paypal.com/tagmanager/pptm.js
    //www.paypal.com/sdk/js?client-id=[....]

    The (2) external scripts are not easy to remove. I’m digging through your code to figure out how it’s loaded. The last script is 124KB!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Zachary Elkins

    (@zacharyelkins)

    Ah, so button.js loads the other two.

    Still, why is this being loaded outside of single product pages and the cart/checkout?

    Titi

    (@thibotus01)

    I agree, as good practice they should load the JS conditionally.

    Plugin Support Inpsyde Niklas

    (@niklasinpsyde)

    Hi there,

    The scripts are only loaded when a button is active on that page.
    So when you have the button for the Mini Cart enabled, then the scripts will be loaded on all non-Cart and non-Checkout pages of your site.
    Disabling it will prevent the scripts from being loaded: https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-mini-cart

    Kind regards,
    Niklas

    leanderbraunschweig

    (@leanderbraunschweig)

    @niklasinpsyde

    Unfortunately we are seeing PayPal’s scripts being loaded on the frontend despite not having Mini Cart or others activated…

    The file /woocommerce-paypal-payments/modules/ppcp-wc-gateway/assets/js/pay-upon-invoice.js is being loaded and in turn other scripts / calls are being initiated such as https://c.paypal.com/da/r/fb.js.

    We have the sandbox mode enabled and the only setting we activated is Enable on Checkout, all other options are NOT active.

    Using the latest version 1.9.0.

    Please look into this asap and let us know if you need anything else in this regards – we can provide a full log as well as backend access if need be.

    Thanks & regards,

    Henning

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.