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
Trigger
Step 1This workflow starts when a new order is created
Condition
Step 2Tags is equal to omake AND Line item group id is empty or does not exist.
Action
Step 3Perform the orderEditBegin mutation
Loop
Step 4item in order.lineItems
Action
Step 5Perform the orderEditCommit mutation
Condition
Step 6Tags is equal to omake AND Line item group id is empty or does not exist.
Action
Step 7Perform the orderEditSetQuantity mutation
Step-by-Step Setup
- 1
**Set Trigger:** Select `Order created` to initiate the workflow.
- 2
**Start Order Edit:** Add `Send Admin API request` using the `orderEditBegin` mutation.
- 3
**Loop Through Items:** Add a `For each` loop to iterate `order.lineItems`.
- 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
**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.
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
Tag & Prioritize High-Value Orders Automatically with Flow
Automatically identify and tag orders above a custom threshold, enabling your team to prioritize high-revenue customers for expedited processing and support.
Automate Repeat Customer Tagging for Smarter Segmentation
Automatically identify and tag loyal shoppers after their second purchase, streamlining segmentation for personalized marketing and service.
How to Automatically Tag Orders Using a Discount Code
Automatically segment your orders by applying a 'Discounted' tag whenever a customer uses a promotional code, simplifying reporting and future marketing efforts.