Skip to main content

Reduce Store Locator frontend assets

Cliq Store Locator separates the public Locator, standalone Search Form, and lead/registration Form applications. A page receives the application used on that page rather than one bundle containing every feature.

Enable icon and marker optimization

  1. Open Store Locator → Settings → Display.
  2. Enable Optimize frontend assets.
  3. Save Settings.
  4. Purge page, object, CDN, and JavaScript optimization caches.
  5. Open a public locator and test its initial cards, category filters, marker selection, Load More, and filtered searches.

The setting builds a site-wide allowlist from all saved Store Locator designs, Stores, Categories, and global settings. Only referenced renderer icons and custom marker records are sent in the public configuration. The list is stored in the WordPress database; the plugin does not create a writable manifest file.

The allowlist is deliberately site-wide. A Store returned after filtering or Load More can therefore use its assigned marker without another asset manifest request.

When the list is rebuilt

The stored list is invalidated when a Store Locator design, Store, Category, Marker, or relevant setting changes. The next public request rebuilds it from current data. Deactivating and reactivating the plugin does not duplicate marker records or continually append icons to the list.

If a cache serves old HTML after changing a marker or icon, purge that cache. The database list may already be correct while the cached page still contains the previous localized configuration.

What each placement loads

PlacementInitial applicationConditional assets
Locator LayoutLocator + shared rendererOnly the configured map provider when the Layout contains a Map widget
Standalone Search FormSearch Form + shared controlsGoogle Places only when configured for location autocomplete
Lead or registration FormForm + shared controlsNo map, results, directions, or print application
Locator without a Map widgetLocator/results stylesNo Leaflet/Google provider SDK or provider adapter

Google and Leaflet adapters are separate. A Google locator does not download the Leaflet adapter, and a Leaflet locator does not download the Google adapter. The complete Google map-theme gallery stays in wp-admin; the public locator receives only its resolved global theme and any explicit per-Map-widget overrides. Custom JSON themes use the same path, so they do not require a public preset file. Directions code loads on the first in-locator directions request, and print code loads on the first Print action.

Caching and JavaScript optimization plugins

The frontend build contains hashed files under resources/frontend/build/chunks/. These are normal application chunks and must remain beside the main build files.

If a map works before cache/minification but fails afterward:

  1. Open DevTools → Network and filter for cliq- or chunks.
  2. Look for a 404, blocked request, HTML response returned for a .js URL, or Content Security Policy error.
  3. Exclude Cliq Store Locator scripts from a tool that combines files into one URL but does not preserve Webpack's chunk base path.
  4. Keep the main Store Locator script and its async chunks on the same deployed plugin version.
  5. Purge generated/minified files after every plugin update.

A stale main file requesting a chunk from a different plugin release can produce ChunkLoadError in the console. Purging every cache layer and redeploying the complete plugin directory fixes the version mismatch; copying only locator.js does not.

Verify the result

Use a private browser window with DevTools → Network open. Reload the exact page and confirm:

  • a standalone Form does not request Leaflet, Google Maps, Store List, directions, or print code;
  • a locator without a Map widget does not request a map provider;
  • only one of the Google or Leaflet adapter chunks loads for a mapped locator;
  • directions and print chunks do not load until their respective action is used;
  • the selected Store's custom marker still appears after searching and Load More.

Do not enable optimization as a workaround for duplicate Google Maps scripts. Use Settings → Map for that case.