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.
Although scripts are flexible, they do have some limitations. Here are some things you might need to consider when building scripts for your store.
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 will carefully track 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
Script 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.
Script box character limit
The script box has a character limit of 8192.