Integration Guide: Launching your First Price Test on your Shopify Plus Store

Learn how to integrate your Shopify Plus store with Intelligems for a Pricing Test using Checkout Scripts.

In this article:

Prerequisites: Download the Intelligems App and approve billing.

If you have not already done so, please download the Intelligems app from the Shopify app store and approve billing in the Settings section in the app.

❗If you have chosen to have Intelligems complete the integration, many of these steps will be done on your behalf. Feel free to jump over to this article for an overview of the onboarding process and next steps.

Step 1: Add Intelligems JavaScript.

Add Intelligems JavaScript as a source into your theme.liquid file.

  <script src="<your_customer_id>.js"></script>

Your individual script tag is located on the settings page in the Intelligems App. 

Screen Shot 2022-12-06 at 12.07.20 PM

❗If your store does not have a checkout.liquid file, you can request one from Shopify.

Step 2: Set up your test.

If you have not already done so, the next step in the integration is to create your first Pricing Test. Check out our guide on doing this here. Don't worry - it won't be going live right away and you can always make edits before launching it!

Step 3: Tag product prices.

The next step to start a Pricing Test is to make sure the Intelligems app is aware of all the places where prices appear in your store by confirming that all product price and compare-at-price locations be tagged - these tags allow the app to dynamically modify the price for each test group. The easiest way to do this is using the Integration Widget, which we'll walk you through step-by-step in this article.

Step 4: Add the Checkout Script.

❗You must be using Shopify Plus to integrate with Intelligems using the Checkout Script. Please see our Non-Shopify Plus guide if this does not apply to you.

The Intelligems checkout script will not apply any discounts or make other changes to orders until a price test is live

Follow the below steps to add the Intelligems Line Items checkout script to your Scripts Editor. Shopify Scripts Editor enables changing the price in the cart so that your customers pay exactly the price they see.

  1. In your Shopify admin, go to Apps and click on Scripts Editor.
  2. If you already have a Line Items script, you can create a copy and edit it. Make sure our script runs first so that discounts get applied in the correct order. If you do not already have a Line Items script, create a new one.
  3. Paste the loop below into the script. Save and publish the script.
class Intelligems
  def initialize(discount_property = '_igp', allow_free = false)
    @volume_discount_property = '_igvd'
    @volume_discount_message_property = '_igvd_message'
    @depreciated_property = '_igLineItemDiscount'
    @discount_property = discount_property
    @allow_free = allow_free

  def discount_product(line_item)
    ig_price =[@discount_property])

    discount = line_item.line_price - ig_price
    if discount >
      discount *= line_item.quantity
      line_item.change_line_price(line_item.line_price - discount, message: 'Discount')


  def depreciated_discount_product(line_item)
    discount =[@depreciated_property])
    discount *= line_item.quantity

    if @allow_free or discount < line_item.line_price
      line_item.change_line_price(line_item.line_price - discount, message: 'Intelligems')

  def volume_discount(line_item)
    discount =[@volume_discount_property])
    discount *= line_item.quantity

    if discount < line_item.line_price
      message =[@volume_discount_message_property]
      line_item.change_line_price(line_item.line_price - discount, message: message)

  def run(cart)
    cart.line_items.each do |line_item|
      if ![@discount_property].nil? && ![@discount_property].empty?
    elsif ![@volume_discount_property].nil? && ![@volume_discount_property].empty?
    elsif ![@depreciated_property].nil? && ![@depreciated_property].empty?

intelligems =

Output.cart = Input.cart

Step 5: Update your cart.

During the Integration, the Intelligems discount message will occasionally show in the cart or the compare-at price will not display correctly. Should this happen, follow these steps to correct the issue and complete the integration.

Remove Hidden Line Item Properties

Most Shopify stores use a convention that any line item with a leading _ should not be displayed in the cart. Here is a common example of how that is implemented in a liquid cart.

The key lines are as follows:

{% assign first_character_in_key = p.first | truncate: 1, '' %}
{% unless p.last == blank or first_character_in_key == '_' %}

And the result should look like this:

{% assign property_size = | size %}
{% if property_size > 0 %}
  {% for p in %}
    {% assign first_character_in_key = p.first | truncate: 1, '' %}
    {% unless p.last == blank or first_character_in_key == '_' %}
      {{ p.first }}:
      {% if p.last contains '/uploads/' %}
        <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
      {% else %}
        {{ p.last }}
      {% endif %}
    {% endunless %}
  {% endfor %}
{% endif %}

You can learn more about this here.

Hide the Discount
If we're using the Checkout Scripts to apply a "hidden" discount on a product, we don't want to show the user that they're receiving an Intelligems discount.

This snippet will create a variable intelligems_discount per line item which is either 0 or a non-zero number in cents which represents the Intelligems price change. This can also be used to adjust compare-at prices if desired.

    {% assign intelligems_total = 0 %}
{% for item in cart.items %}
{% case %}
{% when "0" or nil or blank %}
{% assign intelligems_discount = 0 %}
{% else %}
{% assign intelligems_discount = | plus: 0 %}
{% assign intelligems_total = intelligems_total | plus: %}
{% endcase %}
{% endfor %}

For the strikethrough price, we might include the condition:

{% if intelligems_discount == 0 %}
{% endif %}

So the final result will look like:

{% if item.original_line_price and item.original_line_price != item.line_price and intelligems_discount == 0 %}
<span style="text-decoration:line-through;">{{ item.original_line_price | money }}</span><br>
{% endif %}
Hide the Discount Message

Sometimes discount messages appear to communicate bundle discounts, etc. In this case, we'll want to hide our message using the following:

{% if item.message and item.message != "" and item.message != "Intelligems" %}
<br><span>({{ item.message }})</span>
{% endif %}

Integrating Using HandleBars

Follow the example below if you use HandleBars in your theme. Add the HandleBar functions to the rest of your HandleBar functions.

// JS 

Handlebars.registerHelper('noIgDiscount', function(arg1, options) {
return (arg1.find(discount => discount.discount_application.title === 'intelligems' )) ? options.inverse(this) : options.fn(this) ;
Handlebars.registerHelper('hasExtraDiscounts', function(arg1, options) {
return arg1.some(discount => discount.discount_application.title !== 'intelligems' ) ;


{{#if discountsApplied}}
{{#if (hasExtraDiscounts discounts)}}
<small class="cart__price--strikethrough">{{{price}}}</small>
<span class="ajaxcart__price">
<small class="cart__price">{{{price}}}</small>

{{#if shouldShowComparePrice}}
<small class="cart__price--strikethrough">{{{comparePrice}}}</small>
<span class="ajaxcart__price {{#if shouldShowComparePrice}}tw-text-red{{/if}} ">

{{#if discountsApplied}}
<div class="text-right grid__item">
{{#noIgDiscount discounts}}
{{#each discounts}}
<small class="ajaxcart__discount cart__discount">

Step 6: QA your integration.

After you have completed all previous integration steps, go through your store using Preview Mode in the Integration Widget (see more on how to start preview mode here) and make sure everything looks correct. Follow our QA checklist here!

Step 7: Publish your theme changes and start your first test.

Once you have verified Intelligems is fully integrated, you can publish your theme changes (if you haven't already) and start your test from the Intelligems App! Check out our step-by-step guide on doing this here

What happens next?

Now that you've started your first test, here are some things to do next: