Support » Plugins and Hacks » Stop WooCommerce Html Requests / Files on Site Load

Stop WooCommerce Html Requests / Files on Site Load

  • Does anyone know how to stop woocommerce html requests and files loading on non-woocommerce URLs on a site? And only load when someone visits store pages.

    Currently the requests / files load on the homepage and all other pages, which adds numerous requests and payload to my site load.



Viewing 11 replies - 1 through 11 (of 11 total)
  • Roy Ho


    Not exactly sure what you mean. What files are you referring to?

    I’d be interested in this too.

    I’m pretty sure the process to remove requests/functionality [per page] for Woocommerce is the same for many other plugins too.

    Instead of focusing only on Woocommerce, try broadening your search query to something like “block wordpress plugin requests”. It may take some digging.

    I’d help you in your search, but I’m working on some other site issues at the moment :/

    Good luck, and let me/us know if you find anything!

    @slashingpixels – will try to clarify. When testing homepage and other pages load times on pingdom, I see that woocommerce adds many html requests and file kb’s, impacting load speed. I only want requests to run if someone’s clicks on a Woo-Store page URL.

    @apcgallery – good idea and thanks for the suggestion. Will broaden and report back.

    Roy Ho


    Well first of all don’t use pingdom as it is the worse testing site ever. Pingdom loads everything! Do a search on Google about pingdom and you will see several indepths article on how inaccurate pingdom is.

    The other thing is if having WooCommerce activated and loading some assets on pages that are not e-commerce is causing your page to slow down where you notice, then I would suggest changing host. As it should not impact your site to a point where you will know the difference with naked eye.

    On the other hand if you are keen to not load any assets from WooCommerce unless on a actual e-commerce page, you can do that as well.

    You can do a conditional check, probably something like this.

    if ( ! is_woocommerce() ) {
    wp_dequeue_script( 'woocommerce' );

    There are other scripts you can add to that list to remove from. Checkout the woocommerce.php file in the plugin.

    Thks Roy. I experimented but couldn’t get that making a difference

    Should that conditional check be put in woocommerce.php, functions.php or elsewhere?

    Roy Ho


    Your theme’s functions.php file.

    thanks, tried that… didn’t work unfortunately.

    Roy Ho


    It most absolutely will work…how did you determine it didn’t work? Did you look at the page source?

    Roy Ho


    You can also try this…

    add_action( 'wp_enqueue_scripts', 'my_remove_scripts', 999 );
    function my_remove_scripts() {
    	if ( ! is_woocommerce() )
    		wp_dequeue_script( 'woocommerce' );

    But take note that there may be other JS that depends on what you’re removing so you may need to remove those too…As I stated in my comments earlier in this thread.

    @msite, were you able to find out the solution? I am also looking for a solution to stop loading all woocommerce script on home page, but so far haven’t figure it out.



    Forum Moderator

    @ric668: As per the Forum Welcome, please post your own topic.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Stop WooCommerce Html Requests / Files on Site Load’ is closed to new replies.