# Boost Search + Flair

Jan 07, 2025

On this page

\\
BoostView on the Shopify App Store](https://apps.shopify.com/product-filter-search?utm_source=flaircommerce&utm_medium=link&utm_campaign=integrations)

## Before you begin...

The instructions vary depending on your Flair generation and Boost versions.

### How to determine your Boost app version

Visit the **Boost app** \> **Account Settings** \> **App preferences** \> **App version**.

- If the version says _Boost TURBO_, you are using Boost TURBO.

Otherwise, follow these steps to determine which legacy Boost version you are using:

- Open the [Shopify theme code editor](/content/docs/flair/how-tos/edit-theme/index.html#edit-theme-code).

- Open the **layouts/theme.liquid** file.

- If you see the following: `{% include 'bc-sf-filter' %}`, you are on Boost v1.

- If you see the following: `{% include 'boost-pfs' %}` or `{% render 'boost-pfs' %}`, you are on Boost v2.

- Otherwise, you are on Boost v3.

## Boost Turbo

- Visit the **Boost app** \> **Integration** \> **Third-party Integration** \> **Product Label**.
- Activate the **Flair Product Badges + Labels** and then click **Okay**.

## Boost v3

Edit **assets/boost-sd-custom.js**:

```js
if (window.boostSDAppConfig) {  window.boostSDAppConfig.integration =  Object.assign({ labels: 'flair' }, window.boostSDAppConfig.integration || {});}Copied!
```

And add **line 1**.

### Customizing

Boost v3 provides a customization API to modify the rendered items.

**Display Option: Under the product title**

Edit **assets/boost-sd-custom.js** and add the following code:

```js
const customize = {
  updateProductItem: (componentRegistry) => {
    componentRegistry.useComponentPlugin('ProductItem', {
      name: 'Add Flair under the title',
      enabled: true,
      apply: () => ({
        afterRender(element){
          let productData = element.getParams().props.product;
          let productItem = document.querySelector('.boost-sd__product-item[data-product-id="'+ productData.id +'"]');
          let flairEl = productItem.querySelector('[data-flair-product-badge]');
          if (flairEl) {
            productItem.querySelector('.boost-sd__product-title').after(flairEl);
          }
        }
      }),
    });
  }
}
window.__BoostCustomization__ = (window.__BoostCustomization__ ?? []).concat([customize.updateProductItem]);Copied!
```

**Display Option: On top of the product image**

This option requires configuring a [Flair badge layout](/content/docs/flair/features/layouts/index.html) with position set to **absolute**.

Edit **assets/boost-sd-custom.js** and add the following code:

```js
const customize = {
  updateProductItem: (componentRegistry) => {
    componentRegistry.useComponentPlugin('ProductItem', {
      name: 'Add Flair on top of the product image',
      enabled: true,
      apply: () => ({
        afterRender(element){
          let productData = element.getParams().props.product;
          let productItem = document.querySelector('.boost-sd__product-item[data-product-id="'+ productData.id +'"]');
          let flairEl = productItem.querySelector('[data-flair-product-badge]');
          if (flairEl) {
            productItem.querySelector('.boost-sd__product-image').append(flairEl);
          }
        }
      }),
    });
  }
}
window.__BoostCustomization__ = (window.__BoostCustomization__ ?? []).concat([customize.updateProductItem]);Copied!
```

## Boost v2

Edit **assets/boost-pfs-filter.js** as follows:

Find the **ProductGridItem.prototype.compileTemplate** function

```js
ProductGridItem.prototype.compileTemplate = function (data) {
    // The beginning of this function was removed for brevity
    // You should only add the next line
    itemHtml = itemHtml.replace(/{{itemFlairHtml}}/g, '<div data-flair-product-badge data-product-id="' + data.id.toString() + '"></div>');
    return itemHtml;
  };Copied!
```

And add **line 4**.

Find the **ProductList.prototype.afterRender** function

```js
ProductList.prototype.afterRender = function(data) {
  if (!data) data = this.data;
  if (typeof FlairApp !== 'undefined' && FlairApp) { FlairApp.refreshProductBadges(); }
};Copied!
```

And add **line 3**.

**Display Option: Under the product title**

To add Flair badges under the product title, edit **snippets/boost-pfs-filter-html.liquid**:

```liquid
<h3 class="card__heading {{cardIsHeadingFive}}">
    <a href="{{itemUrl}}" class="full-unstyled-link">
      {{itemTitle}}
    </a>
  </h3>
  {{itemFlairHtml}}Copied!
```

And add **line 6**.

**Display Option: On top of the product image**

This option requires configuring a [Flair badge layout](/content/docs/flair/features/layouts/index.html) with position set to **absolute**.

To add Flair badges on top of the product image, edit **snippets/boost-pfs-filter-html.liquid**:

```liquid
<div class="card__inner {{cardInnerProductClass}}" style="--ratio-percent: {{imageAspectRatio}}%">
  {{itemImages}}
  <div class="card__content">
    {{itemFlairHtml}}Copied!
```

And add **line 4**.

## Boost v1

Open the **assets/bc-sf-filter.js** file in the Shopify theme editor.

Find the **bcSfFilterTemplate** variable.

```js
var bcSfFilterTemplate = {
  'productGridItemHtml': // ... shortened for brevity
    '<h2 class="productitem--title">' +
    '<a href="{{itemUrl}}" tabindex="1">' + '{{itemTitle}}' + '</a>' +
    '</h2>' +
    '<div data-flair-product-badge data-product-id="{{itemId}}"></div>' +Copied!
```

And add the Flair badge DIV to the product grid item template as shown on **line 6**.

Find the **BCSfFilter.prototype.buildExtrasProductList** function.

```js
BCSfFilter.prototype.buildExtrasProductList = function(data, eventType) {
if (typeof FlairApp !== 'undefined' && FlairApp) { FlairApp.refreshProductBadges(); }
};Copied!
```

And add **line 2**.

Navigation

Closecross-small
