| name | shopify-functions |
| description | Build Shopify Functions for custom discount, payment, and delivery logic in a WASM sandbox.
Use when creating custom discount rules, payment customizations, delivery options,
or cart transformations that run server-side at checkout.
Trigger with phrases like "shopify functions", "shopify discounts",
"shopify wasm", "custom discount function", "shopify checkout customization".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 2.7.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ecommerce","shopify"] |
| compatibility | Designed for Claude Code |
Shopify Functions
Overview
Shopify Functions execute custom business logic in a WebAssembly sandbox at checkout: discounts, payment filtering, delivery customization, and cart transforms. They run server-side with strict constraints (11ms execution, 1MB memory, no network access) and replace Shopify Scripts.
Prerequisites
- Shopify CLI 3.x+ installed (
npm install -g @shopify/cli)
- Shopify Partners account with a development store
- App configured for the target function API type
Instructions
Step 1: Configure the Function Extension
api_version = "2025-01"
type = "product_discounts"
[[targeting]]
target = "purchase.product-discount.run"
input_query = "extensions/product-discount/input.graphql"
export = "run"
Step 2: Define the Input Query
The input query declares what data your function receives at runtime:
query Input {
cart {
lines {
quantity
merchandise {
... on ProductVariant {
id
product { hasAnyTag(tags: ["VIP-DISCOUNT"]) }
}
}
}
}
discountNode
metafield , value