Shopify scripts are one of the lesser-known features of the Shopify Plus platform. They are, however, probably the most powerful.
They allow merchants to create Ruby scripts that can automatically discount items, offer free shipping and modify payment gateways based on who the customer is and/or what they have in their cart.
Getting started with Shopify Scripts
First things first, you will need to install the free Shopify Script Editor app via the app store. Keep in mind that this app is only available for Shopify Plus merchants.
To date, there are 3 different script types:
- Line item scripts. They affect line items in the cart and can change prices and grant discounts to your customers
- Shipping scripts. They interact with the Shipping API and change shipping methods and grant discounts on shipping rates
- Payments scripts. They interact with the Payment API and can rename, hide and reorder payment gateway
You can write, edit, test and manage your scripts directly through the Shopify Script Editor app, as seen here:
Once you open the App, you’ll see 3 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
Ready to dive in? You’ll find below 3 curated lists to get you started with Shopify scripts.
Keep in mind that you must be a Shopify Plus merchant with the Shopify Script Editor app installed. Oh, and here’s the official documentation. It might come in handy.
Curated list of Shopify line item scripts
Give free product if the cart is over $X
Source: Ethercycle
Buy 2 get 1 free
Source: Dylan Hunt
Buy 1 get 1 for $X
Source: Dylan Hunt
Buy 1 get 1 for X% off
Source: Dylan Hunt
X% off when the customer placed more than Y orders
Source: Dylan Hunt
Spend at least $500, get $10 off
Source: Pixel2HTML
$X off for new customers
Source: Dylan Hunt
X% off for new customers
Source: Dylan Hunt
Curated list of Shopify shipping scripts
Discounted shipping if the cart is over $X
Source: Dylan Hunt
Free shipping if cart is over $X
Source: Dylan Hunt
Free shipping if cart is over X (excluding certain states)
Source: Onlygrowth
Free shipping on rate based on the name of the rate
Source: Dylan Hunt
Free shipping for customers that spent over $X
Source: Onlygrowth
Free shipping for customers with VIP tag
Source: Onlygrowth
Curated list of Shopify payments scripts
Remove Paypal if a product is tagged with “no-paypal”
Source: Golightly+
Create your own scripts with Shopify Script Creator
Shopify has recently released a web app to quickly create scripts without Ruby knowledge. It’s still in beta but you can give it a try here.