An Introduction to the Shopify Script Editor
Shopify includes a powerful feature called the Shopify Script Editor to allow Shopify store owners to offer dynamic promotions to their customers. Prior to the Shopify Script Editor, automatic discounts, such as quantity breaks or buy one get one free offers, were difficult to do, required additional apps, or were just not possible.
In this post, I’ll cover an introduction to everything you need to know about the Shopify Script Editor. This includes who can and should use it (hint: currently Shopify Plus merchants only), what you can and can’t do with Shopify Script Editor scripts, as well as some things to watch out for when using them within your store.
Who can / should use the Shopify Script Editor?
First off, the Shopify Script Editor is only available for Shopify Plus merchants. If you are not a Shopify Plus store, you may want to read on to see if this feature is worth an upgrade, or you can skip the rest of this article.
Second, the Shopify Script Editor is fairly technical and will require some development knowledge. Shopify Script Editor scripts use the Ruby programming language under the covers to control how discounts and promotions are applied.
So if you run a Shopify Plus store, and have access to a developer (or don’t mind paying for one), the Shopify Script Editor is a powerful way to run dynamic promotions within your store.
How does the Shopify Shopify Script Editor work?
The Shopify Script Editor is a Shopify app built by Shopify. You can install it within your Shopify Plus store via the app store here.
The Shopify Script Editor includes an interface for building and managing scripts as seen here:
The Shopify Script Editor interface for a script includes three sections:
Code- for editing the Ruby code associated with the script
Input- for adding items to the cart, customer details and a cart discount code
Output- for verifying the results of the Code and the Input
Shopify Script Editor scripts are written in the Ruby programming language. The script has access to cart details such as line items, products and variants, as well as information about the customer and any cart discounts applied.
Shopify will run this script during each customer checkout. This gives you the chance to apply custom discounts on-the-fly based on the contents of each customer’s cart.
What types of changes can you make with a Shopify Script Editor script?
There are currently 3 types of changes you can make to a customer’s cart using a Shopify Script Editor script:
- line item price changes - you can change the price of any line item in the cart, including making the item free
- split line items - if a line item includes a quantity of more than 1, you can split it and adjust the price of a portion of the items (e.g. - buy one get one free)
- line item property changes - you can modify the line item properties for items in the cart
These changes enable a huge variety of possible discounts and promotions within your store.
What kinds of discounts and promotions can you run using the Shopify Script Editor?
You can run basically any discount or promotion that involves modifying the price of items in the customer’s cart.
Here is a list of the types of Shopify Script Editor discounts you can add to your store:
- Buy X Get Y free types of promotions such as BOGO
- Percentage off discount
- Fixed dollar amount discount
- Bulk or tiered discounts
- Wholesale or VIP discounts
Publishing your Shopify Script Editor script
Once you have your Shopify Script Editor script working the way you’d like, you hit the Save and publish button to activate it. Each Shopify store can only have one published Shopify Script Editor script at a time. As a result, it is fairly common to have multiple promotions active within a single script.
Shopify will then run your published script for every checkout within your store.
Shopify Script Editor limitations
Since Shopify Script Editor scripts run during checkout, extra care must be taken to make sure the checkouts keep flowing smoothly. As a result, Shopify paid extra attention to detail to make sure Shopify Script Editor scripts should not impact the checkout process.
Shopify added restrictions to make sure scripts run in a timely manner, and don’t consume too many resources.
Shopify currently enforces the following limitations on Shopify Script Editor scripts:
Character limits- scripts are limited to a maximum of 8,192 characters (including comments and whitespace)
CPU / Memory- the total number of instructions your script can perform, as well as the amount of memory it consumes, are limited (limits are calculated at runtime, and are viewable in the Script Editor interface)
Time- scripts can not access the current date or time so time-based discounts have to be manually published
Input / Output- scripts are not able to call out to any other services or APIs for data
Additional Shopify Script Editor resources
Here is a list of some of the best online resources I’ve found on the Shopify Script Editor:
- Shopify Script Editor Manual
- Shopify Script Editor app
- Shopify Script Editor Ruby API docs
- Shopify Script Editor Theme docs
The Shopify Script Editor is a powerful way to add automated discounts and promotions to your store in a way that was previously difficult if not impossible to do.
If you are a Shopify Plus store owner, this is a great feature that enables promotions for your store that can help boost your conversions and average orders sizes.
Are you planning on adding a Shopify Script promotion to your store and need help? Feel free to contact me here and let’s chat.