Shopify Functions: What They Replace and What They Enable

The Evolution of Checkout Customization

Shopify Scripts allowed custom Ruby code for discounts, shipping, and payment customization. Functions are the next generation, offering more capability and better performance.

What Functions Do

Discount Functions

Create custom discount logic beyond native capabilities. Tiered discounts, complex conditions, bundle pricing, loyalty rewards.

Shipping Functions

Customize shipping rate presentation. Hide, rename, or reorder shipping options based on cart contents or customer attributes.

Payment Functions

Control payment method availability. Hide payment options based on order value, product type, or customer segment.

Validation Functions

Add custom checkout validation. Block checkout based on business rules. Ensure cart meets requirements before proceeding.

Functions vs Scripts

Execution model

Scripts ran Ruby code on Shopify's servers. Functions run WebAssembly with strict execution limits and no network access.

Performance

Functions are faster. WebAssembly execution is more efficient than Ruby interpretation.

Capability

Functions cover more extension points than Scripts. New capabilities like checkout validation are only available via Functions.

Migration

Existing Scripts continue working. Migration to Functions requires rewriting logic in a supported language.

How Functions Work

Development

Write code in Rust or JavaScript. Define what inputs you need from Shopify. Define the output your function returns.

Deployment

Package as part of a Shopify app. Deploy to Shopify's infrastructure. Configuration in the app provides settings.

Execution

When checkout reaches the extension point, Shopify calls your function with relevant data. Your function returns decisions that Shopify applies.

Limitations

No external calls

Functions cannot call external APIs during execution. All data must come from Shopify's input or metafields.

Execution limits

Strict time and resource limits. Functions must execute quickly.

Input constraints

Functions receive defined inputs. You cannot access arbitrary Shopify data during execution.

Use Cases

Complex discounting

Tiered discounts based on cart value, quantity, customer segment, or product combinations.

Member pricing

Different pricing for logged-in members validated at checkout.

Shipping restrictions

Hide shipping options that do not apply to certain products or addresses.

Cart validation

Enforce minimum order values, product compatibility, or regulatory restrictions.

For Functions development, see custom Shopify apps.

Working with LiftKit Digital

LiftKit Digital develops Shopify Functions for checkout customization needs. We help migrate from Scripts and build new capabilities Functions enable.

To discuss Functions, get in touch.