Boost AI Search & Filter
Platmart Color Swatches works with Boost AI Search & Filter by Boost Commerce. Boost narrows the collection, and swatches show the color choices on each product card.
What you need to do depends on your Boost version:
- Boost V3: nothing. Turn on the Collection swatches app embed, and swatches appear on Boost’s product cards and stay there when shoppers filter, sort, or paginate.
- Boost V2: add the snippet below. Your store is on V2 if your theme has files that start with
boost-pfs-. - Boost V1 or Turbo: contact support with your store URL, and we’ll send the right setup.
Set up Boost V2
Section titled “Set up Boost V2”Boost V2 draws product cards from its own template and redraws them each time results change. Swatches need a container in that template and a reload call after each redraw.
-
In your theme editor, open App embeds and turn on Collection swatches.
-
Open
boost-pfs-filter-html.liquidand add the swatch container where you want swatches to appear:<div data-pl-swatches-collection data-product-id="{{product.id}}" data-product-url="{{itemUrl}}"></div>If your theme doesn’t have that file, open
boost-pfs-filter.jsand add the same container to theproductGridItemHtmlvariable, using Boost’s own variables:<div data-pl-swatches-collection data-product-id="{{itemId}}" data-product-url="{{itemUrl}}"></div> -
In
boost-pfs-filter.js, add this to theFilter.prototype.afterRenderfunction so swatches reload after Boost redraws the grid:if (typeof PlatmartSwatchesCollection != 'undefined') {PlatmartSwatchesCollection.load()}if (typeof PlatmartVariantSwatchesCollection != 'undefined') {PlatmartVariantSwatchesCollection.load()}
Swatches now stay on product cards when shoppers filter or paginate.