Stripe.js api call slows down website on WooCommerce Product Page
-
I have found several other threads on this so I am very surprised not to find an actual solution that fixes this very critical problem. =
https://echo-3.co.uk/wp-content/plugins/woocommerce/assets/client/blocks/mini-cart-frontend.js?ver=eba896c62201a23c4175 – This is the file in question which is making the API call to stripe which is very heavy (600kb) and it does not seem necessary ? As the user is of course not going to be paying for their item on the product page. However, if I even defer this script then I get this error:
Uncaught TypeError: window.wc is undefined <anonymous> https://echo-3.co.uk/wp-content/plugins/woocommerce/assets/client/blocks/mini-cart-frontend.js?ver=eba896c62201a23c4175:1 <anonymous> https://echo-3.co.uk/wp-content/plugins/woocommerce/assets/client/blocks/mini-cart-frontend.js?ver=eba896c62201a23c4175:3
So it seems that this code is coming from the WooCommerce core.
There is not just the API call to stripe in this file but there are some things which I may need, hence the error ? But because they are in the same file I cannot just defer the entire file.
I even tried to block the API call to Stripe in the functions.php file but sadly did not have any success.
If you could please advise if there is a hook that I could use to stop this API call happening on the WooCommerce product page or what the solution is to this issue ? As this is a very heavy asset to load when it may not be needed
Thanks
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.