RP Promap JS Widget: Disable Marker Clustering
Widget Purpose (patch fix)
This widget prevents the Promap store locator from using marker clustering when clustering is disabled in the Promap settings.
Use this when SCASLSetting.cluster is set to 0, but the locator still loads or initializes markerclusterer.js.
The widget safely wraps MarkerClusterer before it is used. If clustering is disabled, it returns a no-operation clusterer so the locator can continue running without grouping map markers.
Widget Code
{% comment %} RP Promap JS Widget Widget: Disable MarkerClusterer When Promap Clustering Is Off Purpose: Prevents marker clustering from running when window.SCASLSetting.cluster is not enabled. Placement: Add before markerclusterer.js is loaded by the store locator. {% endcomment %} <script> (function () { 'use strict'; var WIDGET_NAME = 'RP Promap - Conditional MarkerClusterer'; function clusteringEnabled() { return !!( window.SCASLSetting && Number(window.SCASLSetting.cluster) === 1 ); } function createNoopClusterer(markers) { return { markers_: Array.isArray(markers) ? markers.slice() : [], clearMarkers: function () {}, addMarker: function () {}, addMarkers: function () {}, removeMarker: function () { return false; }, repaint: function () {}, redraw: function () {}, fitMapToMarkers: function () {} }; } function wrapMarkerClusterer(OriginalMarkerClusterer) { if ( !OriginalMarkerClusterer || OriginalMarkerClusterer.__rpPromapClusterWrapped ) { return OriginalMarkerClusterer; } function PatchedMarkerClusterer(map, markers, options) { if (!clusteringEnabled()) { return createNoopClusterer(markers); } return new OriginalMarkerClusterer(map, markers, options); } PatchedMarkerClusterer.prototype = OriginalMarkerClusterer.prototype; if (Object.setPrototypeOf) { Object.setPrototypeOf(PatchedMarkerClusterer, OriginalMarkerClusterer); } PatchedMarkerClusterer.__rpPromapClusterWrapped = true; PatchedMarkerClusterer.__rpPromapWidgetName = WIDGET_NAME; return PatchedMarkerClusterer; } function installWrapper() { if (window.MarkerClusterer) { window.MarkerClusterer = wrapMarkerClusterer(window.MarkerClusterer); return; } var currentValue; Object.defineProperty(window, 'MarkerClusterer', { configurable: true, enumerable: true, get: function () { return currentValue; }, set: function (value) { currentValue = wrapMarkerClusterer(value); } }); } installWrapper(); })(); </script>Liquid Placement Example
Add the widget directly before this script:
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js"></script>
Example:
{% comment %} RP Promap JS Widget Disable MarkerClusterer when Promap clustering is off. {% endcomment %} <script> (function () { 'use strict'; function clusteringEnabled() { return !!( window.SCASLSetting && Number(window.SCASLSetting.cluster) === 1 ); } function createNoopClusterer(markers) { return { markers_: Array.isArray(markers) ? markers.slice() : [], clearMarkers: function () {}, addMarker: function () {}, addMarkers: function () {}, removeMarker: function () { return false; }, repaint: function () {}, redraw: function () {}, fitMapToMarkers: function () {} }; } function wrapMarkerClusterer(OriginalMarkerClusterer) { if ( !OriginalMarkerClusterer || OriginalMarkerClusterer.__rpPromapClusterWrapped ) { return OriginalMarkerClusterer; } function PatchedMarkerClusterer(map, markers, options) { if (!clusteringEnabled()) { return createNoopClusterer(markers); } return new OriginalMarkerClusterer(map, markers, options); } PatchedMarkerClusterer.prototype = OriginalMarkerClusterer.prototype; if (Object.setPrototypeOf) { Object.setPrototypeOf(PatchedMarkerClusterer, OriginalMarkerClusterer); } PatchedMarkerClusterer.__rpPromapClusterWrapped = true; return PatchedMarkerClusterer; } if (window.MarkerClusterer) { window.MarkerClusterer = wrapMarkerClusterer(window.MarkerClusterer); } else { var currentValue; Object.defineProperty(window, 'MarkerClusterer', { configurable: true, enumerable: true, get: function () { return currentValue; }, set: function (value) { currentValue = wrapMarkerClusterer(value); } }); } })(); </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js"></script>Intercom Help Article
Disable Marker Clustering When Promap Clustering Is Turned Off
Promap includes a clustering setting that controls whether nearby map pins should be grouped together. In some Shopify themes, the external markerclusterer.js library may still load even when clustering is disabled.
This widget makes sure the marker clusterer only runs when Promap clustering is enabled.
When clustering is turned off, the widget replaces the clusterer with a safe no-operation version. This allows individual store markers to display normally without being grouped.
When to Use This Widget
Use this widget if:
Store pins are still clustering even though clustering is disabled.
You want every store location to appear as an individual map marker.
Your Shopify theme manually loads
markerclusterer.js.Your locator page includes this script:
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js"></script>
Where to Add the Widget
Add the widget in your Shopify theme Liquid file before markerclusterer.js loads.
Common locations include:
resources/sections/sca-storelocator.liquid resources/templates/page.sca-storelocator.liquid
Or the theme section/snippet that loads the store locator.
The widget must run before this line:
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js"></script>
Installation Steps
Open your Shopify theme code editor.
Locate the store locator Liquid file or snippet.
Find the
markerclusterer.jsscript include.Paste the RP Promap widget directly above it.
Save the file.
Refresh the store locator page and test the map pins.
Full Widget Code
{% comment %} RP Promap JS Widget Widget: Disable MarkerClusterer When Promap Clustering Is Off Purpose: Prevents marker clustering from running when window.SCASLSetting.cluster is not enabled. Placement: Add before markerclusterer.js is loaded by the store locator. {% endcomment %} <script> (function () { 'use strict'; function clusteringEnabled() { return !!( window.SCASLSetting && Number(window.SCASLSetting.cluster) === 1 ); } function createNoopClusterer(markers) { return { markers_: Array.isArray(markers) ? markers.slice() : [], clearMarkers: function () {}, addMarker: function () {}, addMarkers: function () {}, removeMarker: function () { return false; }, repaint: function () {}, redraw: function () {}, fitMapToMarkers: function () {} }; } function wrapMarkerClusterer(OriginalMarkerClusterer) { if ( !OriginalMarkerClusterer || OriginalMarkerClusterer.__rpPromapClusterWrapped ) { return OriginalMarkerClusterer; } function PatchedMarkerClusterer(map, markers, options) { if (!clusteringEnabled()) { return createNoopClusterer(markers); } return new OriginalMarkerClusterer(map, markers, options); } PatchedMarkerClusterer.prototype = OriginalMarkerClusterer.prototype; if (Object.setPrototypeOf) { Object.setPrototypeOf(PatchedMarkerClusterer, OriginalMarkerClusterer); } PatchedMarkerClusterer.__rpPromapClusterWrapped = true; return PatchedMarkerClusterer; } if (window.MarkerClusterer) { window.MarkerClusterer = wrapMarkerClusterer(window.MarkerClusterer); } else { var currentValue; Object.defineProperty(window, 'MarkerClusterer', { configurable: true, enumerable: true, get: function () { return currentValue; }, set: function (value) { currentValue = wrapMarkerClusterer(value); } }); } })(); </script>How It Works
The widget checks this Promap setting:
window.SCASLSetting.cluster
If the value is 1, clustering remains enabled.
If the value is not 1, the widget prevents the real MarkerClusterer from running and uses a safe placeholder instead.
This keeps the locator functional while allowing all markers to display individually.
Important Notes
This widget must be added before
markerclusterer.js.It does not remove store markers.
It does not change store data.
It only controls whether the marker clusterer is allowed to initialize.
If clustering is enabled in Promap settings, the original clusterer still runs normally.
Troubleshooting
Markers are still clustering
Confirm that the widget is placed before markerclusterer.js.
The map does not load
Check the browser console for JavaScript errors and confirm the widget was copied completely.
Nothing changed
Clear the theme cache, refresh the page, and confirm the locator template being edited is the active one.
