Lightspeed

Recommendations

Automate and personalise products on any page in Lightspeed.

Create Design #

Recommendations are shown as a slider by default. You can either use the Design Editor to configure it visually, or use code designs.

Design Editor #

  1. Go to Recommendations > Designs and click New Design.
  2. Choose Product Slider
  3. Pick a template to start from, give it a name and click Create design.
  4. Adjust the design as needed.

Code Design #

  1. Go to Recommendations > Designs and click New Design.
  2. Choose Other designs > Blank > With code.
  3. Give it a name and click Create design.
  4. Create a code design from scratch using Liquid code.

If you want a starting design, check the Slider template further down.

Create Content #

This contains all settings used to show the Recommendations slider and make it embeddable.

  1. Go to Recommendations > Slider.
  2. Click New Slider.
  3. Name it descriptively, e.g. “Home / Visitor”.
  4. In Slider type, choose the product logic to use.
  5. In Design, select the design you created and choose the number of products.
  6. Click Save.

Add to Website #

To add Clerk Recommendations on your website, you have two options: Injection and Embedded code.

To access your theme files in Lightspeed, click “Design” in the left-side menu, then “Code bewerken” in the Geavanceerd dropdown.

To add sync details or start a sync, go to my.clerk.io > Data > Configuration.

Plugin Setup #

Not available for Lightspeed. Use the my.clerk.io Setup below.

my.clerk.io Setup #

  1. Go to Recommendations > Slider.

  2. Select the slider you want to insert.

  3. Open the Insert into website tab.

  4. Choose one of the following:

    • Using injection allows you to insert the code using a CSS selector.
    • Using embedded code allows you to insert the code into your website manually.
  5. For embedded code on Lightspeed, typical placements are:

    • Homepage: snippets/homepage.rain.
    • Product page: product.rain and set data-products to [{{product.id}}].
    • Category page: collection.rain and set data-category to {{ collection.category_id }}.
    • Brand page: In collection.rain, wrap brand logic in an {% if collection.category_id %} ... {% else %} ... {% endif %} to differentiate.
    • Cart page: fixed.rain with an IF around the embed code: {% if 'cart' in template %}{% endif %} and set data-products to:
    data-products="[{% for clerk_line in page.cart.products %}{{ clerk_line.id }}{% if loop.length > 1 and not loop.last %}, {% endif %}{% endfor %}]"
    

Powerstep #

  • First, create your Recommendations Design and Slider in my.clerk.io that you’d like to add to the powerstep.

  • Find the powerstep snippet file in the Snippets section of your theme files, popup-buy.rain in this example. Paste the embed code generated from your Slider here:

<div style="display: none;" id="clerk_powerstep">
  <div class="clerk_powerstep_wrap">
    <span class="clerk-powerstep-recommendations"
      data-template="@power-step-others-also-bought"
      data-products="[{{product.id}}]">
    </span>
  </div>
</div>
<script>
  document.addEventListener('DOMContentLoaded', function(){
    var buyBtn = (document.querySelector('[data-add-to-cart]')) ? '[data-add-to-cart]' : '.productCartButton';
    document.querySelector(buyBtn).addEventListener('click', function(){
      Clerk('content', '.clerk-powerstep-recommendations');
      document.getElementById('clerk_powerstep').style.display = 'block';
    });
  });
</script>

Some embed codes require variables like product or category IDs. In these cases, they’ll be populated in the embed code, but be sure to double-check these are the correct variables to reference within your Lightspeed portal.

Cart Page #

  1. In my.clerk.io, create a Slider with the logic Best Cross-Sell Products.
  2. In the Insert into website > Choose your platform dropdown, select Lightspeed, and copy the embedcode.
  3. Insert the embedcode in your cart page template (e.g., fixed.rain with an IF around the embed code: {% if 'cart' in template %}{% endif %}). Set data-products to the cart product IDs.

Exit Intent #

  1. In my.clerk.io, create a Slider with the logic Visitor Recommendations.
  2. Exit Intent is added to your main theme file, likely custom.rain.
  3. Place the Slider embed code generated in my.clerk.io just before the closing tag. If you have Live Search implemented, the Exit Intent code should be placed just after this.
  4. Add data-exit-intent="true" to the embedcode.
<span class="clerk"
  data-template="@exit-intent"
  data-exit-intent="true">
</span>

Starting Templates #

If you want to use code designs, these templates can get you started.

Slider Code #

This template will render a standard slider with common product information that you can tailor to your needs.

HTML #

<div class="clerk-recommendations">
    <h2 class="section-title" style="text-align:center; text-transform: uppercase;"><span>{{ headline }}</span></h2>

    <div class="clerk-slider">
         {% for product in products %}
            <div class="clerk-slider-item">
                <div class="clerk-slider-product">
                    <a href="{{ product.url }}">
                        {% if product.price < product.list_price %}
                            <div class="clerk-slider-badge">On Sale</div>
                        {% endif %}
                        <div class="clerk-slider-image" style="background-image: url('{{ product.image }}');"></div>
                        <div class="clerk-slider-brand">{{ product.brand }}</div>
                        <div class="clerk-slider-name">{{ product.name }}</div>
                        
                        <div class="clerk-slider-pricing">
                            {% if product.price < product.retail_price %}
                                <div class="clerk-slider-list-price">{{ product.retail_price | money }}</div>
                            {% endif %}
                            
                            <div class="clerk-slider-price">{{ product.price | money }}</div>
                        </div>
                    </a>
                    {% if product.stock == 0 %}
                        <a class="clerk-not-in-stock" href="{{ product.url }}" data-event-type="product-click">
                            <div class="clerk-slider-button-not-in-stock">Out of Stock</div>
                        </a>
                    {% else %}
                        <a class="clerk-view-product" href="{{ product.url }}" data-event-type="product-click">
                            <div class="clerk-slider-button">View Product</div>
                        </a>
                    {% endif %}
                </div>
            </div>
        {% endfor %}
    </div>
</div>

CSS #

.clerk-recommendations {
    margin: 1em 0;
}

.clerk-recommendations-headline {
    font-weight: bold;
    font-size: 2em;

    text-align: center;
}

.clerk-slider-item {
    margin: auto;
}

.clerk-slider-product {
    position: relative;
    overflow: hidden;

    margin: 1em;
    padding: 1em;

    background-color: white;

    border: 1px solid #eee;
    border-radius: 1em;

    box-shadow: 0 .1em .2em 0 rgba(0,0,0,.08);

    text-align: center;
}

.clerk-slider-badge {
    position: absolute;
    top: 5px;
    right: -35px;

    display: inline-block;

    width: 120px;

    margin: 10px auto;
    padding: 5px 0;

    border-radius: 3px;

    background-color: #fbc531;

    font-size: 10px;
    color: white;

    text-align: center;
    letter-spacing: 1px;

    transform: rotate(45deg);
}

.clerk-slider-tags {
    position: absolute;
    top: .8em;
    left: .8em;
}

.clerk-slider-tag {
    display: inline-block;

    padding: .2em .8em;

    border-radius: .3em;

    background-color: gray;

    font-size: 10px;
    color: white;

    letter-spacing: 1px;
}

.clerk-slider-image {
    width: 100%;
    height: 8em;

    margin-bottom: 1em;

    background-position: center center;
    background-repeat: no-repeat;
    background-size: contain;
}

.clerk-slider-brand {
    font-size: 0.9em;
    color: #757575;
}

.clerk-slider-name {
    height: 3em;
    overflow: hidden;
    color: #4a3b40;
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 1em;
}

.clerk-slider-pricing {
    display: flex;

    margin-bottom: 1em;
}

.clerk-slider-price {
    flex: 1;
    color: #757575;
    font-weight: bold;
}

.clerk-slider-list-price {
    flex: 1;
    
    opacity: .8;
    
    font-weight: normal;
    text-decoration: line-through;
    color: gray;
}

.clerk-view-product, .clerk-view-product:hover {
    color: white;
}

.clerk-not-in-stock, .clerk-not-in-stock:hover {
    color: #4a3b40;
}

.clerk-slider-button-not-in-stock {
    display: block;

    margin: 0 auto;
    padding: .6em 2em;

    border: none;
    border-radius: .5em;

    background-color: white;
    color: #4a3b40;

    text-transform: uppercase;
    text-align: center;

    white-space: nowrap;

    font-weight: bold;

    cursor: pointer;
}

.clerk-slider-button {
    display: block;

    margin: 0 auto;
    padding: .6em 2em;

    border: none;
    border-radius: .5em;

    background-color: #b6c254;
    color: white;

    text-transform: uppercase;
    text-align: center;

    white-space: nowrap;

    font-weight: bold;
}


.clerk-load-more-button {
    display: block;
    
    width: 20em;

    margin: 1em auto;
    padding: .6em 2em;

    border: none;
    border-radius: .5em;

    background-color: #b6c254;
    color: white;

    text-transform: uppercase;
    text-align: center;

    white-space: nowrap;

    font-weight: bold;
    font-size: 1.2em;
}

@media screen and (min-width: 1100px){
    .clerk-slider-item {
        width: 20%;
    }
}

@media screen and (min-width: 900px) and (max-width: 1100px){
    .clerk-slider-item {
        width: 25%;
    }
}

@media screen and (min-width: 414px) and (max-width: 900px) {
    .clerk-slider-item {
        width: 50%;
    }
    .clerk-slider-button, .clerk-slider-button-not-in-stock {
        font-size: 0.8em;
    }
}

@media screen and (max-width: 413px) {
    .clerk-slider-item {
        width: 100%;
    }
}