A practical Shopify Node template for API development (July 2025) that demonstrates dynamic bundle creation using Cart Transform Functions and metafield-driven configuration.
This project is designed to help developers learn how to:
- map a target product to a bundle product from an admin UI
- store transformation rules in Shopify metafields
- automatically expand cart line items at runtime via Shopify Functions
- Dynamic bundle creation at cart level (no fixed bundle products required)
- Metafield-driven transform rules for flexible configuration
- Admin product selection flow using Shopify App Bridge
- Automatic cart transform creation when missing
- Backend endpoints for reading and writing transform config
- Shopify Function-based line expansion for performant checkout logic
- Frontend: React, Shopify Polaris, Shopify App Bridge
- Backend: Node.js, Express
- Shopify APIs: GraphQL Admin API, Metafields API, Cart Transform API
- Runtime Logic: Shopify Functions (
cartTransformRun)
You select:
- Target product variant:
Product A - Bundle product variant:
Product B
The configuration is saved in metafield:
- Namespace:
app - Key:
function-configs - Type:
json
Product A(qty: 1)
Product A(qty: 1)Product B(qty: 1)
{
"transform": [
{ "id": "target_variant_id", "title": "Target Product" },
{ "id": "bundle_variant_id", "title": "Bundle Product" }
]
}-
Product Selection (Frontend)
- Admin picks target and bundle products from resource picker.
-
Save Config (Backend + Metafield)
POST /api/cart/create-transformwrites configuration usingmetafieldsSet.
-
Resolve Transform (Backend)
GET /api/cart/transformationsfetches existing transform and creates one if absent.
-
Cart Runtime Execution (Shopify Function)
cartTransformRun(input)reads cart lines and metafield config.- If a target match is found, it expands the line with the mapped bundle variant.
/frontend
├── pages/HomePage.jsx
├── components/
/backend
├── index.js
├── shopify.js
├── product-creator.js
/functions
├── cartTransformRun.js
/graphql
├── CartTransformRunInput.query.graphql
This project is open source under the MIT License.
StackWise Dev
Created for educational purpose to demonstrate Shopify Cart Transform API patterns with a Node template.