Black Friday

30% off premium pluginsEnds 2 December

Shop the sale
Simple Wishlists

How can we help?

Search the documentation or ask the AI agent anything about the plugin.

Page caching compatibility

Simple WishlistsUpdated

The wishlist works with full-page caching out of the box, with no special setup in your caching plugin. The wishlist buttons and counters are the same for every visitor, so pages can be cached as usual. Each shopper’s saved items are loaded with one small request after the page loads, and only for shoppers who have a wishlist.

How it works

  • The HTML of the buttons and counter never contains anything about the current visitor.
  • When a visitor has saved something, the plugin sets a small cookie, swlp_has_items, which only holds the number of saved items.
  • On each page, the script checks for that cookie (or a logged-in visitor). Only then does it make one request to fill in the hearts and the count.
  • Visitors who have saved nothing cause no extra requests and no database queries.

Your cache does not need to vary by the swlp_has_items cookie. The same cached page works for every visitor.

Pages kept out of the cache

When a shopper views their own wishlist, the page is personal. The plugin sets the DONOTCACHEPAGE constant, which most caching plugins follow, and sends no-cache headers. Shared views of a list (opened from a share link) are the same for everyone, so they can be cached.

Requests your cache must not block

The plugin’s requests go to WooCommerce’s AJAX address, for example /?wc-ajax=swlp_state and /?wc-ajax=swlp_toggle. These must not be cached. Most caching plugins already skip wc-ajax requests. If you use a CDN or server cache with custom rules, check that query strings with wc-ajax are passed through.

Script optimisation plugins

The storefront script has no jQuery dependency and is small. If a plugin delays JavaScript until the visitor interacts with the page, the hearts may fill in late. If that is a problem, exclude the plugin’s frontend.js file from delay settings.

Related

Was this article helpful?