Shopify
Shopify Functions vs Scripts: When to Use Which

Shopify Functions and Shopify Scripts are both server-side customization tools, but they solve different problems. Choosing the wrong one leads to unnecessary complexity or limitations you'll hit at the worst possible moment.
What are Shopify Functions?
Functions run on Shopify's edge network and are written in JavaScript (or Wasm). They handle discounts, payments, shipping, and validation — anything that needs to modify the checkout or cart before the final calculation.
What are Shopify Scripts?
Scripts run in Ruby on Shopify's servers during checkout. They're older, more flexible in some ways, but limited to specific use cases and being phased out in favor of Functions.
Decision framework
Use Functions for new projects and checkout customizations. Use Scripts only if you're maintaining an existing integration that hasn't migrated yet. The migration path from Scripts to Functions is straightforward but requires planning.
The key insight: Functions are Shopify's future. Scripts are the past. Build with Functions unless you have a compelling reason not to.