Re: Check order has Subscription item and add line item from flow

Solved

Check order has Subscription item and add line item from flow

Nalinda
Shopify Partner
35 0 14

Hi All,

We need to add a free item if the order contains a line item with a Subscription (selling plan)

I can't figure out the condition for this, can you please help.

The below condition work for all variants with the selling plan, even if the item is a one-time purchase in the order.

But I need it to run if only the line item is added to use with subscription.

 

Thank you!

Monosnap DOG by Dr Lisa US · Flow · Shopify Plus 2023-05-24 10-25-48.png

Accepted Solution (1)

Brian_S
Shopify Partner
171 21 44

This is an accepted solution.

Hey Nalinda - we've had success doing this with merchants by checking that a contract exists on any of the lines:

 

Brian_S_1-1684914699579.png

 

Or you could use Awtomic Subscriptions which provides subscription specific Shopify Flow actions and triggers. In this case you'd use one of our "Subscription Billing Attempt Success" triggers.  From there you could add an item to the order or use one of our actions to update the contract (like add a discount or free one time item)

 

Brian_S_2-1684915059173.png

 

Brian Singer
CTO & Cofounder of Subscription Service - Awtomic

View solution in original post

Replies 4 (4)

DaveMcV
Shopify Staff
104 31 29

Hi Nalinda,

 

Have you tried just looking at whether `order.sellingPlans` is empty? Looking at the Product's Selling Plan Groups is not relevant to the specific order whereas `order.sellingPlans` should be.

Something like this might be worth trying:

DaveMcV_0-1684890084170.png


Hope that helps!

DaveMcV | Flow Development Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Nalinda
Shopify Partner
35 0 14

Thanks a lot, @DaveMcV ,

This is work fine with recurring subscriptions but didn't work with the first order.

@Brian_S solution worked for the both first and recurring subscriptions orders.

Regards!

Brian_S
Shopify Partner
171 21 44

This is an accepted solution.

Hey Nalinda - we've had success doing this with merchants by checking that a contract exists on any of the lines:

 

Brian_S_1-1684914699579.png

 

Or you could use Awtomic Subscriptions which provides subscription specific Shopify Flow actions and triggers. In this case you'd use one of our "Subscription Billing Attempt Success" triggers.  From there you could add an item to the order or use one of our actions to update the contract (like add a discount or free one time item)

 

Brian_S_2-1684915059173.png

 

Brian Singer
CTO & Cofounder of Subscription Service - Awtomic
Nalinda
Shopify Partner
35 0 14

Hey @Brian_S , 

It works perfectly, thanks a lot

Cheers!