1. Home
  2. Knowledge Base
  3. WooCommerce Product Table
  4. Product Table Features
  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 the product table 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:

  • The search box will only search within the title and description columns.
  • Users can only sort the table by the name, price, reviews and date columns. (You can still use the sort_by option to sort the table by name, id, menu order, date, modified date, price, popularity or rating when it first loads.)
  • 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. When a user clicks on a filter, the plugin will fetch all products matching that filter from the database.

Was this article helpful?

Related Articles