Adding/Removing a variant to an order with Flow

Topic summary

A user is attempting to add or remove product variants from orders using Shopify Flow, but encounters an “invalid ID” error when using the orderEditAddVariant GraphQL mutation via Flow’s “Send Admin API request” action.

The Issue:

  • The mutation requires a CalculatedOrder ID, not a standard Order ID
  • Direct order editing through this mutation isn’t straightforward

Suggested Solution:

  • A Flow template exists demonstrating how to add items to orders and apply 100% discounts
  • For $0 items specifically, Flow’s built-in “Add order line item” action can be used
  • Conditions or custom code can determine which variant to add
  • Reference template link provided for implementation guidance

Status: The question remains open regarding non-zero priced variants, though a workaround exists for free items.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

My question is, is there a way to add/remove variants from an order with Flow based on what is in the order?

Have been trying to use the GraphQL mutation orderEditAddVariant however I am getting an “invalid ID” error whenever I fire the mutation via a “Send Admin API request”. I suspect it’s because the mutation is looking for a CalculatedOrder ID rather than an Order ID.

Any pointers in the right direction are greatly appreciated :slightly_smiling_face:

Darren

There is a template showing how to add an item to an order and then discount it 100%. You can’t just edit the order with this mutation and if you read the docs you’ll see id is NOT an order id.

That said, if your item is $0, you can use Flow’s built in “Add order line item” action. And use a condition/code to determine which variant to add.

https://shopify.com/admin/apps/flow/editor/templates/01929bd2-3888-7e92-80b2-a003486aac62