Code Monkey home page Code Monkey logo

woocommerce-assets-conditional-loader's Introduction

WooCommerce-Assets-Conditional-Loader

This WordPress plugin snippet conditionally unloads WooCommerce assets on non-WooCommerce pages, helping to optimize the loading speed of your site. By default, WooCommerce can load its scripts and styles on every page, even if the page doesn’t need them. With this enhancement, WooCommerce assets will only load on WooCommerce-related pages, reducing unnecessary requests and improving performance.

Features:

  • Checks if WooCommerce is active on your site.
  • Unloads WooCommerce assets on non-WooCommerce pages.
  • Improves website performance by reducing unnecessary asset loading.

Installation:

  1. Copy the provided code into your theme's functions.php file or as a standalone plugin.
  2. Navigate your website; WooCommerce assets will now load only on relevant pages.

Usage:

After installing:

  1. WooCommerce assets will automatically be dequeued on non-WooCommerce pages.
  2. Visit any non-WooCommerce page on your site and inspect the source. You should no longer see WooCommerce scripts and styles loaded.
  3. Visit a WooCommerce-related page, like the shop, cart, or checkout, and you'll see that WooCommerce assets are properly loaded.

Contribution:

Feel free to fork this repository and contribute by submitting a pull request.

License:

This code is available under the MIT License.


You can save this content to a README.md file in the root directory of your GitHub repository. It will provide visitors with information about what the project does and how to use it.

You can contact [email protected] about Woocommerce and Wordpress developments, e-commerce and website building.

For more information about GrowthBX https://growthbx.com

woocommerce-assets-conditional-loader's People

Contributors

cuneytrizacelik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.