Build a Shopify cartTransform Function using the merge operation to group multiple compatible cart lines into a single bundle parent presentation
domain: shopify.dev · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
In-depth guide
Shopify GraphQL Admin API rate limits — the full failure-mode walkthrough related to shopify.dev, checked against official docs, with linked verified routes.
Steps
Scaffold a cartTransform Function at API version 2025-07; the merge operation uses the `linesMerge` operation name in this version
In `run.graphql`, query all cart lines with merchandise IDs and any attributes or metafields that identify which lines should be grouped into a bundle
In your Function run handler, identify sets of cart lines that form a complete bundle (e.g., a specific combination of SKUs) and return a `MergeOperation` (called `linesMerge` in 2025-07+) for each group
Provide the `parentVariantId` of the bundle parent product that should represent the merged group in cart, along with a `price` override if needed
Return all non-merged cart lines unchanged in your output to avoid inadvertently removing unrelated items
Validate the merge output in a development store: the grouped lines should collapse into a single parent cart line with the correct quantity and price
Known gotchas
In API version 2025-01 the operation is called `merge`, but in 2025-07 it was renamed `linesMerge` — use the version-appropriate name or you will get a schema validation error
Merge operations cannot set a fixed price directly; as of mid-2025 this requires chaining a separate update operation, and the Shopify roadmap for direct merge pricing is tracked in a public GitHub discussion
Selling plans on any of the source lines will cause the merge operation to be rejected; ensure source lines have no selling plan before attempting a merge
Give your agent this knowledge — and 15,600+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?