shopify-functions

Shopify Functions differ from traditional backend apps. They are compiled to WASM and run on Shopify's infrastructure with extremely low latency. They are the successor to Shopify Scripts (Plus).

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "shopify-functions" with this command: npx skills add toilahuongg/shopify-agents-kit/toilahuongg-shopify-agents-kit-shopify-functions

Shopify Functions

Shopify Functions differ from traditional backend apps. They are compiled to WASM and run on Shopify's infrastructure with extremely low latency. They are the successor to Shopify Scripts (Plus).

  1. Concepts
  • Deterministic: Same input always equals same output. No random numbers, no network calls.

  • Execution Time: Strict limits (e.g., 5ms for logic).

  • Languages: Rust (First-class) or JavaScript (via Javy).

  1. Structure

A function consists of:

  • shopify.extension.toml : Configuration.

  • input.graphql : Defines data sent to the function.

  • src/run.rs (or .js ): The logic that returns an Output .

  1. Workflow
  • Generate: shopify app generate extension --template product_discounts --name my-discount

  • Input Query: Modify input.graphql to request necessary data (Cart, Customer, etc.).

  • CodeGen: Run shopify app function typegen to generate types from your GraphQL query.

  • Logic: Implement the run function.

  • Build: npm run build (compiles to .wasm ).

  • Deploy: shopify app deploy .

  1. JS Example (Product Discount)

// src/run.js // @ts-check

/**

  • @typedef {import("../generated/api").RunInput} RunInput
  • @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult */

/**

  • @param {RunInput} input
  • @returns {FunctionRunResult} */ export function run(input) { const targets = input.cart.lines .filter(line => line.merchandise.product.hasAnyTag) .map(line => ({ cartLine: { id: line.id } }));

if (!targets.length) { return { discounts: [], discountApplicationStrategy: "FIRST", }; }

return { discounts: [ { targets, value: { percentage: { value: "10.0" } }, message: "VIP Discount" } ], discountApplicationStrategy: "FIRST", }; }

  1. Configuration (GraphiQL)

You can't console.log in WASM. Use the Shopify App Bridge helper or the locally served GraphiQL explorer to debug inputs/outputs.

Run npm run dev , then open the highlighted GraphiQL URL in the terminal.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

shopify-api

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shopify-extensions

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shopify-webhooks

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shopify-metafields

No summary provided by upstream source.

Repository SourceNeeds Review