Shopify Flow/Order Tagging & Segmentation/Automate Removal of Unclaimed Gift Bags from Orders
Operational EfficiencyHigh Difficulty

Automate Removal of Unclaimed Gift Bags from Orders

Automatically removes gift products from orders when a customer doesn't meet the gift-with-purchase criteria, ensuring accurate order fulfillment and preventing costly mistakes.

The Problem

Shipping gift bags to customers who didn't qualify for them leads to wasted product, packaging, and shipping costs. This not only erodes profit margins but also creates inventory discrepancies and adds manual work for your fulfillment team to correct orders post-purchase.

What This Automation Solves

This Flow activates when an `Order is created`. It checks each `line item` for 'omake' tagged products that don't have a valid gift group ID, indicating they're unclaimed. Using `Admin API requests`, it efficiently `removes these items` by setting their quantity to zero, ensuring clean, accurate orders for fulfillment.

When to Use This Automation

  • You offer tiered gift-with-purchase promotions via an app like Omake, and customers sometimes add gifts they don't qualify for.
  • Your fulfillment team frequently encounters extra, unqualified gift products in orders, leading to manual removals.
  • You need to maintain precise inventory counts for your gift products and reduce waste from incorrect shipments.

Workflow

  1. Trigger

    Step 1

    This workflow starts when a new order is created

  2. Condition

    Step 2

    Tags is equal to omake AND Line item group id is empty or does not exist.

  3. Action

    Step 3

    Perform the orderEditBegin mutation

  4. Loop

    Step 4

    item in order.lineItems

  5. Action

    Step 5

    Perform the orderEditCommit mutation

  6. Condition

    Step 6

    Tags is equal to omake AND Line item group id is empty or does not exist.

  7. Action

    Step 7

    Perform the orderEditSetQuantity mutation

Step-by-Step Setup

  1. 1

    **Set Trigger:** Select `Order created` to initiate the workflow.

  2. 2

    **Start Order Edit:** Add `Send Admin API request` using the `orderEditBegin` mutation.

  3. 3

    **Loop Through Items:** Add a `For each` loop to iterate `order.lineItems`.

  4. 4

    **Conditional Removal (inside loop):** Add a `Condition` to check if `item.tags` equals 'omake' AND `item.properties.line_item_group_id` is empty. If true, use `Send Admin API request` with `orderEditSetQuantity` to set the current item's quantity to zero.

  5. 5

    **Finalize Edit:** After the loop, add `Send Admin API request` with the `orderEditCommit` mutation.

Related Questions

What if my gift-with-purchase app isn't Omake?
The core logic remains the same. You'll need to adjust the `condition` in Flow to match the specific tag or line item property your gift app uses to identify gifts and determine qualification.
Will removing items from an order affect inventory immediately?
No, editing an order to remove items via API typically adjusts inventory only when the order is fulfilled. Until then, the initial ordered quantity might still be reserved.
Can this Flow also add a tag to the order if items were removed?
Yes, you can add an `Add order tag` action *after* the `orderEditCommit` step, perhaps conditionally only if any items were indeed removed, to signal to your fulfillment team.
What happens if a customer claims they qualified for a gift that was removed?
The Flow automates based on your store's logic. If a customer believes there was an error, your customer service team can review the order's history and Flow's activity log for auditing.

Recommended Tools & Apps

Launch this automation

Open Shopify Flow and use this page as your setup blueprint.

Open Shopify Flow

Merchant Insight

Always test this Flow extensively in a staging environment or with test orders first. Incorrect API calls can lead to unrecoverable order issues. Verify your gift app's tagging and property scheme carefully before deployment.

Related Automations

How to Automate Removal of Unclaimed Gift Bags from Orders | Shopify Flow Library