decarvalhoaa / woopoly

The Wordpress WooCommerce Polylang integration plugin
https://wordpress.org/plugins/woopoly/
MIT License
10 stars 2 forks source link

woopoly causes checkout gateway javascripts to be loaded on every page #22

Open Jon007 opened 8 years ago

Jon007 commented 8 years ago

With the wooCommerce Stripe gateway enabled + woopoly, additional gateway references are added to every page, whereas normally they would only be needed on the checkout page.

This was particularly noticable since from my current country location the script: https://checkout.stripe.com/v2/checkout.js?ver=2.0 takes 5-15 seconds to load. and is doesn't permit caching. so if woopoly is enabled it adds 5-15 seconds to every single page load.

Testing with base product install (twentysixteen theme, woocommerce + stripe gateway + Polylang), the following scripts are loaded:

/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.js?ver=2.6.4
/wp-content/plugins/woocommerce/assets/js/jquery-blockui/jquery.blockUI.js?ver=2.70
/wp-content/plugins/woocommerce/assets/js/frontend/woocommerce.js?ver=2.6.4
/wp-content/plugins/woocommerce/assets/js/jquery-cookie/jquery.cookie.js?ver=1.4.1
/wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.js?ver=2.6.4

After turning on woopoly: The following script is removed: /wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.js?ver=2.6.4

The Stripe scripts are added as well as the woopoly script:

/wp-content/plugins/woopoly/public/js/Cart.js?ver=1.0.0
/wp-content/plugins/woocommerce-gateway-stripe/assets/js/stripe_checkout.js?ver=3.0.2
https://checkout.stripe.com/v2/checkout.js?ver=2.0
Jon007 commented 8 years ago

This bug cannot be reproduced in newly updated Hyyan Version 0.27. I suspect that #23, #22 and a couple of other things I have seen are related, however I can't reproduce them on Hyyan 0.27 so I would probably close this and continue with the Hyyan version.