Script requirements and limitations
To create scripts, you need a Shopify Plus plan and the Script Editor. You also need knowledge of the Ruby programming language, or access to a developer or Shopify Expert who knows Ruby.
Some script limitations exist to enhance security and to make sure that scripts can run no matter how many customers your store has at any given time. Keep the following restrictions in mind if you are developing scripts for your Shopify store.
Online store and the Storefront API
When you create or edit a script, you choose whether it will run in your online store only or in your online store and in the following apps:
- Private apps that generate checkouts
- Tapcart and Plobal Apps mobile app builders
Only one script per script type can be published at a time. For example, you can publish a line items script and a shipping rates script, but you can't publish two line items scripts at the same time.
Line item scripts, shipping scripts, and payment scripts don't work with draft orders or the draft orders checkout.
Shopify Scripts cannot access metafields.
Shopify Scripts cannot access Shopify Liquid cart attributes. You can add these attributes to your cart pages to collect extra information from your customers, but you can't create a script that uses them.
Regular expression matching is not supported. If you are creating a line item script, then you might be able to use one of the following methods as a workaround:
You might need to update your Liquid theme to support your scripts and more importantly so that you don't confuse your customers. For example, not all themes show line item discounts in the cart. If this is your case, then you need to edit your theme to show the line items discounts in the cart. Learn more about the types of modifications that you can make to your Liquid themes.
The amount of CPU and memory available to a script is limited. The resources reserved for a script depend on the size of the cart and the amount of calculations that the script requires. Shopify carefully tracks these resource limits to make sure they don't prevent your script from working as intended.
When you test a script, the Script Editor console prints the percentage of allocated resources that the script is using.
With a few exceptions, Shopify Scripts are not capable of input/output. This means that scripts cannot execute web requests or database calls, and cannot get input from a user.
puts method, however, can be used to print text to the console in the Script Editor app.
Time and randomness
Scripts cannot involve random or time-based calculations. The
Time object and
rand method cannot be accessed by Shopify Scripts.
Because scripts run every time a cart's total is recalculated, scripts based on time or random number generation could have unpredictable or confusing results if a customer changes their cart often. However, you can schedule scripts to run during events using the Launchpad app.
Script character limit
You can create scripts up to 24,576 characters long.
When you're using Shopify Scripts with accelerated checkouts, shipping discounts are applied after your customer selects an accelerated payment method. Because of this, changes to the order's price are not reflected on the customer's device or browser. Customers see the original price on their accelerated checkout, but will be charged the correct discounted price.