Shopify Scripts requirements and limitations

Some Shopify Scripts limitations exist to enhance security and to make sure that scripts can run no matter how many customers use your store 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 only in your online store, or in your online store and in the following apps:

For scripts to work, your website must have built-in shopping cart functionality, so you can't use scripts with Buy Buttons or the Facebook and Instagram by Meta sales channel.

Published scripts

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.

Maximum number of Shopify Scripts

You can create up to 200 Shopify Scripts.

Draft orders

Line items scripts, shipping rates scripts, and payments scripts don't work with draft orders or the draft orders checkout.

Metafields

Shopify Scripts can't access Metafields.

Cart/checkout attributes

Shopify Scripts can't 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.

Discount codes

Scripts can access whether a discount code is applied, the amount of the discount, and the type of discount, such as fixed amount, percentage, or shipping. Scripts can't access how the discount code is applied, for example if it's cart-specific or line item-specific. This means that Scripts can't access post-discount totals or automatic discounts.

Line item and shipping scripts that access discounts applied to a cart aren't compatible with discount combinations. The .discount_code method can only return a single discount code. Carts that include multiple discount codes using discount combinations aren't supported.

Line items

Scripts can't add items to the cart or increase an item's price.

Shipping rates

Scripts can't increase a shipping rate's price.

Multi-currency

Your scripts might not work with multi-currency as expected. To ensure that your scripts work for carts or checkout that are in any currency other than your store's primary currency, you need to migrate your scripts to Shopify Functions.

Regular expressions

Regular expression matching isn't supported. If you're creating a line item script, then you might be able to use one of the following methods as a workaround:

  • split method
  • start_with and end_with methods
  • include method

Themes

You might need to update your Liquid theme to support your scripts and to avoid confusing your customers. For example, not all themes display line item discounts in the cart. If this is your case, then you need to edit your theme to display the line items discounts in the cart. Learn more about the types of modifications that you can make to your Liquid themes.

Resources

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 that 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.

Input/output

With a few exceptions, Shopify Scripts aren't capable of input/output. This means that scripts can't execute web requests or database calls, and they can't get input from a user.

The puts method can be used to print text to the console in the Script Editor app.

Time and randomness

Scripts can't involve random or time-based calculations. The Time object and rand method can't be accessed by Shopify Scripts.

Because scripts run every time a cart's total is recalculated, scripts based on time or random number generation might 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 a maximum of 40,960 characters.

Subscription orders

If your line item and shipping scripts create a discount for a subscription product, then the discount applies to the following payments:

  • the first payment of a pay-per-delivery only, without applying to scheduled orders
  • the entire amount of a prepaid subscription order

Learn more about subscriptions and scripts.

Accelerated checkouts

When you use 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 aren't reflected on the customer's device or browser. Customers can view the original price on their accelerated checkout, but they'll be charged the correct discounted price.

Shopify Point of Sale (POS)

Shopify Scripts don't work with Shopify Point of Sale (POS).

Renaming payment gateways

You can't rename payment gateways that have images or logos displayed as the name of the gateway. Payment gateways with logo images next to their names can be renamed.

Split shipping in checkout

Shipping scripts are incompatible with split shipping in Shopify Checkout. If you use shipping scripts and activate split shipping, then split shipments aren't displayed to your customers at checkout.

Can’t find the answers you’re looking for? We’re here to help.