Support » Plugin: WooCommerce » Inline Script, why does woocommerce do this instead of external js file?

  • Resolved xarelix

    (@xarelix)


    On my homepage, I display featured products.

    I am also in the process of improving page load times and performance in general.

    One thing I noticed is that WooCommerce seems to use some inline script instead of putting the script into an external js file.

    Is there a setting or way to have WooCommerce instead use external js file.

    My only guess is that maybe there is good reason to do it this way instead of external file?

    here is the sections I am talking about:

    
    <script type="text/javascript">var c = document.body.className;
    		c = c.replace(/woocommerce-no-js/, 'woocommerce-js');
    		document.body.className = c;</script>
    
    <script type='text/javascript'>var wc_add_to_cart_params = {"ajax_url":"\/wp-admin\/admin-ajax.php","wc_ajax_url":"\/?wc-ajax=%%endpoint%%","i18n_view_cart":"View cart","cart_url":"https:\/\/www.kswirewrap.com\/cart\/","is_cart":"","cart_redirect_after_add":"no"};</script>
    
    <script type='text/javascript'>var woocommerce_params = {"ajax_url":"\/wp-admin\/admin-ajax.php","wc_ajax_url":"\/?wc-ajax=%%endpoint%%"};</script>
    
    • This topic was modified 1 year, 3 months ago by xarelix. Reason: more info
    • This topic was modified 1 year, 3 months ago by xarelix.
Viewing 1 replies (of 1 total)
  • edit, I was mistaken, the above script is still there.

    However I noticed one more thing:

    <noscript><style>.woocommerce-product-gallery{ opacity: 1 !important; }</style></noscript>

    I am thinking maybe this is an important one to have though…. like maybe it makes things work when the scripts dont load, hmmm…..

    • This reply was modified 1 year, 3 months ago by xarelix.
    • This reply was modified 1 year, 3 months ago by xarelix.
    • This reply was modified 1 year, 3 months ago by xarelix. Reason: more info
    • This reply was modified 1 year, 3 months ago by xarelix.
Viewing 1 replies (of 1 total)
  • The topic ‘Inline Script, why does woocommerce do this instead of external js file?’ is closed to new replies.