Skip to content

Add Fulfillment option generator function templates#416

Open
otheriault wants to merge 1 commit into
Shopify:mainfrom
otheriault:ot.fulfillment-option-generator-templates
Open

Add Fulfillment option generator function templates#416
otheriault wants to merge 1 commit into
Shopify:mainfrom
otheriault:ot.fulfillment-option-generator-templates

Conversation

@otheriault

Copy link
Copy Markdown
Contributor

What

Adds new function templates for the Fulfillment option generator (cart.fulfillment-options.generate), following the established pickup-point-delivery-option-generators pattern.

Three template directories (one -js covers both vanilla JS and TypeScript via Liquid flavor switches):

  • functions-fulfillment-option-generators-rs — Rust (shopify_function 2.1.0)
  • functions-fulfillment-option-generators-js — JavaScript + TypeScript
  • functions-fulfillment-option-generators-wasm — Wasm placeholder

Registered in templates.json under the Functions group, gated behind an Experiments Platform flag via organizationExpFlags.

Targets

Mirrors the pickup-point fetch + run pattern:

  • cart.fulfillment-options.generate.fetch — returns an external HTTP request (only when the buyer's country is Canada in this demo).
  • cart.fulfillment-options.generate.run — parses the response and emits fulfillmentOptionsAdd operations, with providers/service points deduplicated into the references block.

To simulate an external API, the demo reuses the existing hosted pickup-points JSON file.

Structure parity

Each flavor matches the current pickup-point convention: schema.graphql, fetch/run input queries, the language-agnostic vitest fixture harness (tests/default.test.js + tests/fixtures/*.json), locales, and .liquid source.

Testing

Validated locally:

  • expand-liquid for rust / vanilla-js / typescript / wasm
  • Rust: cargo fmt --check, cargo clippy -- -D warnings, cargo build --release --target wasm32-unknown-unknown
  • JS/TS: graphql-codegen typegen passes (queries validate against the schema; all generated types resolve)
  • Fixtures mirror pickup-point's proven shapes 1:1

Follow-ups (out of this repo)

  • Register the template specification in the Partners repo
  • CDN propagation of templates.json after merge
  • Confirm ExP flag rollout for the gating handle

Add Rust, JavaScript/TypeScript, and Wasm templates for the
cart.fulfillment-options.generate function, following the established
pickup-point-delivery-option-generators pattern (optional fetch target
+ run target with external HTTP access).

- functions-fulfillment-option-generators-rs   (shopify_function 2.1.0)
- functions-fulfillment-option-generators-js    (vanilla-js + typescript)
- functions-fulfillment-option-generators-wasm
- templates.json: register under "Functions", gated by organizationExpFlags

Each flavor mirrors pickup-point structure: schema.graphql, fetch/run
input queries, the language-agnostic vitest fixture harness, and locales.

Assisted-By: devx/afb31d94-b8e2-4abe-ad93-cc5236235202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant