1. Home
  2. Knowledge Base
  3. WooCommerce Product Table
  4. Product Table Shortcode Options
  5. Lazy load option for stores with many products

Lazy load option for stores with many products

The lazy load option uses AJAX to speed up your WooCommerce product tables for sites with large numbers of products.

What is lazy load?

By default, WooCommerce Product Table loads all of the products in the table when it first loads. If you have more products than can fit on a single page of results (e.g. you have 50 products and are showing 20 rows per page) then it will create multiple pages with pagination links under the table. However, all the products on all the pages are loaded at the same time.

For large numbers of products, the default setup can cause a hit on performance as all matching products are fetched from the database and then formatted by the plugin. This can result in slower page load times and – for very large product databases – may even result in a website crash, server or database error when attempting to load the table.

If you have lots of products, then you can activate lazy load to avoid any performance issues. Lazy load uses AJAX to load one page of products at a time.

As your customers navigate between the pages of results in the product table, they will see a “Processing” message displayed (briefly) while the next products are loaded from the database.

How can I enable lazy load?

To enable lazy load, add lazy_load="true" to the product table shortcode.

For example: [product_table lazy_load="true"]

Limitations of lazy load

Enabling lazy load means that all product fetching, searching, and sorting is handled by the server rather than in the browser. This leads to some limitations with tables that use lazy load:

  • Separate variations will not work. If using lazy load, you can only use variations="dropdown", which is the default behaviour.
  • The search box is limited and will only search within the name and description columns.
  • Table sorting is limited to sorting by ID, name, price, reviews and date columns. The sort_by option is also limited – please see the sort_by documentation for details.
  • The search_on_click feature is disabled, so users can’t click on a category or tag to filter the table.

These limitations are due to the way in which WordPress and WooCommerce interact with the database, and are unavoidable.

Please note that the above limitations do not affect the filter dropdowns above the table.

Was this article helpful?

Related Articles