Updating Your Checkout Script for Campaigns

Note that this only applies to brands using our Checkout Script Integration - if you do not see the Checkout Script button in the top right of your Campaigns page in Intelligems, Intelligems will use Functions for your Campaigns, which will be synced automatically.

Background

Each time you set up a new Campaign or Campaign Test in Intelligems, we amend your Checkout Script in the Intelligems app to reflect this. Before starting your Campaign or Campaign Test, you need to update your Checkout Script in the Script Editor app in Shopify to ensure your promotions can be processed correctly. This article will walk you through how to do that.

Step 1: Copy your new Checkout Script

Once you have saved your new Campaign or Campaign test and are not planning on making any other edits to it, head over to the Campaigns tab on the left-hand side of the Intelligems app. In the top right of that page, click on the button that says "Checkout Script" - this will open your most up to date Checkout Script. At the bottom of that window, click the "Copy" button to copy the full Checkout Script to your clipboard.

Step 2: Paste your new Checkout Script in the Script Editor app

Now that you've copied your new Checkout Script, head over to your Shopify admin account, click "Apps" on the left-hand side, and search for the Script Editor app.

If you don't have any Line Item Checkout Scripts live at the moment, click the "Create Script" button in the top right corner and select "Blank Template" under the "Line Items" options. Paste your Campaigns Checkout Script in the code editor. A few tips:

  • You can give your Checkout Script a name under the "Title" field at the top - we recommend naming it the same thing as the Campaign or Campaign Test so you can remember what this script is for.

  • Make sure any example code that Shopify may have added is deleted first.

If you do have a Line Item Checkout Script live at the moment, click on the title of it and select the "Duplicate" button in the top right. You cannot edit published scripts, and this allows you to revert to your old script if you need to in the future. Paste your Campaigns Checkout Script in the code editor. A few tips:

  • The Checkout Script will process in the same order that it is in. Keep in mind what each portion of your Checkout Script does when deciding where to paste the Campaigns Checkout Script.

  • You can edit the name of the Checkout Script under the "Title" field at the top - we recommend adding the name of the Campaign or Campaign Test on to the end of your current title so you can remember what this script is for.

  • If your current Checkout Script already includes an Intelligems Campaigns Checkout Script we recommend deleting the entire Intelligems portion and replacing it with your new, updated Checkout Script.

Step 3: Edit your Campaigns Checkout Script as needed

There are a few edits you may want to make to your Campaigns Checkout Script as it comes by default. See more details on each of those below:

  • By default, there will be a TieredDiscount.new block for every Campaign that you have set up in the Intelligems app. These discounts will only be ran if the Campaign is toggled on in Intelligems, but you can delete any that you aren't planning on running if you would prefer. Reach out to support@intelligems.io for help deciphering which to remove.

  • By default, the discount message that will appear at checkout is "Bundle and Save". You can change that to anything you would like by editing the message in the Checkout Script. See the picture below for where to edit that.

Step 4: Save your Draft

Once you are done editing, you can select the "Save Draft" or "Save and Publish" button in the top right. Publishing the Campaigns Checkout Script will not have any impact on your website until your Campaign or Campaign test is published, but feel free to wait to publish your new Checkout Script until you are ready to start your Campaign or Campaign Test if you would prefer - just make sure you don't forget to publish the Script first!

Last updated