Automate `inCollection` Status Check for New Products via Admin API
Automatically check if a newly created product is part of a specific collection by leveraging the Admin API, even when Flow's standard actions don't offer direct support.
The Problem
Shopify Flow provides powerful triggers, but sometimes a crucial product field, like knowing if a product `inCollection` X, isn't directly available or requires a specific collection ID argument. This forces merchants into manual checks, leading to wasted time, potential miscategorizations, or delays in triggering critical downstream automations, especially when launching new products into curated collections.
What This Automation Solves
This Flow bypasses that limitation by using the `Product created` trigger, then a `Send HTTP request` action to directly query the Shopify Admin API for the `inCollection` status of the newly added product within a *specified* collection ID. A subsequent `Run code` action then parses the API response, making this previously inaccessible data available for further Flow actions, like logging or conditional branching.
When to Use This Automation
- When you need to confirm if newly created products are immediately assigned to a critical collection (e.g., 'New Arrivals', 'Pre-orders') for timely marketing segmentation.
- To trigger external apps or update inventory systems based on a product's presence in a specific collection, which Flow can't natively check with a collection ID argument.
- For auditing purposes, ensuring high-value products are correctly categorized from creation, preventing missed sales opportunities due to incorrect placement.
Workflow
Trigger
Step 1Formerly called Product added to store, this trigger starts when a new product is created
Action
Step 2Call Admin API to get a product field that requires arguments (inCollection).
Action
Step 3Parse response body and return the id and inCollection fields
Action
Step 4For {{runCode.productId}}, the API inCollection field returned: {{runCode.inCollection}} to the run log
Step-by-Step Setup
- 1
Start with the `Product created` trigger to initiate the workflow.
- 2
Add an `Send HTTP request` action configured to call the Shopify Admin API's `product` endpoint, specifying the new product's ID and the target `collectionId` for the `inCollection` query.
- 3
Include a `Run code` action to parse the JSON response body, extracting the `id` and the `inCollection` boolean value.
- 4
Finish with a `Log output` action to record the product ID and its `inCollection` status for review in the Flow run history.
Related Questions
- Why can't Flow check a product's 'inCollection' status for a specific collection directly?
- Flow's standard product data actions typically don't support arguments like a specific collection ID for fields that require them, limiting direct access to certain nuanced Admin API data points without custom HTTP requests.
- Is using 'Send HTTP request' to the Admin API secure in Shopify Flow?
- Yes, Shopify Flow handles API authentication securely in the background when calling the Admin API via the `Send HTTP request` action, so you don't need to embed API keys directly in your Flow.
- Can I use this method to retrieve other Admin API fields not directly available in Flow?
- Absolutely. This `Send HTTP request` and `Run code` pattern is a versatile way to access any Admin API field or endpoint not yet exposed directly in Flow, as long as you know the API endpoint, query structure, and required arguments.
- Are there rate limits when calling the Admin API through Flow's 'Send HTTP request'?
- Yes, Flow's `Send HTTP request` action is subject to the standard Shopify Admin API rate limits. For high-volume stores or complex flows making many API calls, it's wise to monitor your usage to avoid throttling.
Recommended Tools & Apps
Launch this automation
Open Shopify Flow and use this page as your setup blueprint.
Merchant Insight
When setting up the `Send HTTP request` and `Run code` steps, thoroughly test with a sample product. Use the 'View run details' to inspect the raw API response and ensure your `Run code` script accurately parses the JSON path to your desire
Related Automations
Auto-tag Products When Added to Your Sale Collection
Automatically applies a 'Sale' or 'Clearance' tag to products the moment they are added to your designated sale collection, streamlining merchandising.
How to Automatically Tag Products by Vendor
Automatically apply vendor-specific tags to newly created products, streamlining catalog organization and enhancing filtering capabilities for your store.
How to Automatically Create Redirects for Archived Products
Automatically create a 301 redirect URL whenever a product's status changes from active to archived, ensuring customers never hit a dead link.