Performance notes
The plugin is written so that it costs nothing on pages that do not show a product listing and very little on pages that do.
What is loaded, and where#
- Stylesheet (
public/css/quick-view.css) and script (public/js/quick-view.js) are registered on every front-end page but only enqueued when a Quick view button is actually rendered. Pages without listings load nothing. - On classic themes the stylesheet is also enqueued in the head of the shop, archive and product pages, and of singular pages containing a products shortcode or product block, so the button is styled on first paint without a layout shift.
- The script is loaded in the footer with
defer. It depends on jQuery and WooCommerce’swc-add-to-cart-variationscript, and onwc-add-to-cartwhen AJAX add to cart is enabled in WooCommerce. No third-party libraries are bundled. - The modal container is printed in the footer only when a button was rendered on the page.
What happens on click#
- One POST request fetches the product HTML. Nothing is preloaded, so a listing of 50 products costs no more than a listing of 5 until a shopper clicks.
- If a shopper clicks another product while one is loading, the earlier request is cancelled.
- The HTML is cleared when the modal closes, so memory does not grow as shoppers browse.
- Adding to cart uses WooCommerce’s own AJAX add to cart endpoint, the same one the product page uses.
Caching#
- Listing pages can be fully page-cached; the button markup contains nothing that expires.
- The quick view response itself goes through
?wc-ajax=…, which caching plugins exclude by default, so prices and stock are always current. - Settings are read once per request and cached in memory.
Server load#
The AJAX handler renders only the parts you have switched on. If you switch off the gallery, no image markup is generated, and if you switch off the add to cart form, the variation data for variable products is not built.
Was this article helpful?
Tell us what was missing
