The current scope of the abandoned checkout flow does not allow for checking the lineitem “selling_plan_id” parameter. Is there a way in Flow to query an abandoned checkout object and check if the line items are a subscription product or not?
Topic summary
Identifying whether abandoned checkout line items are subscriptions within Shopify Flow.
-
Limitation: Shopify Flow cannot directly check selling_plan_id on abandoned checkouts.
-
Workaround proposed: Use product tags or metafields to mark subscription items and have Flow conditions check those.
-
Constraint: Merchant uses ReCharge and most products can be purchased one-off or via subscription; product-level tags/metafields can’t distinguish the customer’s choice at checkout.
-
Need: Inspect the checkout’s line items to see if a selling plan was selected.
-
Proposed approach: A code snippet checks lineItem.selling_plan_allocation (the line-item attribute indicating a chosen selling plan) to determine if the item is part of a subscription.
-
Central artifact: The JavaScript code snippet is key to the approach.
-
Open questions: How/where to run this code in Shopify Flow (e.g., a “Run Code” block) and what inputs are required.
-
Status: No confirmed implementation details; discussion remains open without a finalized solution.
Hello @ChunkySteveo ,
Shopify Flow doesn’t directly allow you to check the selling_plan_id on abandoned checkouts. Instead, use tags or metafields to mark subscription products. Then, in Flow, check for these tags or metafields to identify subscription products in the abandoned checkout.
For example:
-
Mark subscription products with a tag like subscription.
-
In Shopify Flow, create a condition to check if the abandoned checkout line items have the subscription tag.
-
Take action based on whether the product is a subscription.
Thank!
Hey Steve,
Thanks for the idea, which would be good, but we use ReCharge for subscription items, and as such - we offer the products as one-off items, or to purchase with a subscription/selling_plan. Therefore we can’t distinguish between sub and non-sub products, as they (99% of them) can all be bought singularly or as a subscription plan. This is why we’re needing to query if there’s a selling plan associated with the line item, in the checkout object.
Thanks - Steve
Hello @ChunkySteveo ,
Lets try this method !
const lineItem = checkout.lineItems.find(item => item.id === lineItemId);
if (lineItem.selling_plan_allocation) {
console.log('This item is part of a subscription plan.');
// You can access the selling plan details here
console.log(lineItem.selling_plan_allocation.selling_plan.id);
} else {
console.log('This item is not part of a subscription plan.');
}
Thanks!
Where is that code going in the Flow? Is that part of a “Run Code” action block? If so - what’s the input to be used?
Thanks.
Is that in a “Run Code” block, Steve?