Last few collection automated with products that have either 1 or 2 left in stock for all variants

Highlighted
Tourist
28 0 1

Hi there,

 

I'm looking to create an automated custom collection template called "Last Few" that will ideally pull in products that have more than 0 inventory and less than or equal to 2 inventory for all variants. Is this possible? I know the liquid syntax that is used to check inventory (variant.inventory_quantity) only checks inventory for each variant of a product instead of the total inventory that a product has. 

 

Also wondering if there is a way to have pagination work correctly for automated custom templated collections? For future reference, I'd like to be able to have more than 48 products in a custom collection. 

 

Thanks!

0 Likes
Highlighted
Shopify Partner
131 7 30
0 Likes
Highlighted
Shopify Expert
1381 112 211

Hi,

 

You can set the inventory for the Collection as shown in attached screenshot.

Please let me know if it works for you.

 

inventory stock.png

0 Likes
Highlighted
Tourist
28 0 1

This is currently how I have the collection set up and it's not working the way I want it to. Instead of checking the total inventory, it's checking all the variants of a product and pulling in the products with variants that have 1-2 items left in stock and ignoring the rest. So for example, some products being pulled in have 2 left in stock for size M, and 7 left in size L and it's still being pulled in.

0 Likes
Highlighted
Shopify Expert
1381 112 211

Okay, so as per my understanding, you want only those products that have a total of 0-2 inventory for all the variants. If any product having more than 2 inventory for any of the variants then that product should not be pulled off. Please correct me if I'm wrong.

If this is the case, then that would be code level change and you need to provide me access to your store in order to make this fix.

 

Looking forward to your response.

0 Likes
Highlighted
Tourist
28 0 1

Yes, this is correct. I am a developer looking to make changes on a custom template for this collection myself. Just wanted to see if anyone has achieved this before and could maybe give me some boilerplate code to use/modify.

1 Like
Highlighted
Shopify Expert
1381 112 211

Hi,

 

Since this is a code level change and it requires both time and efforts so I need to have access to your store and it incurs some additional cost as well.

Please let me know your thoughts.

 

 

0 Likes
Shopify Partner
131 7 30

For what it's worth, Arigato can handle those types of very specific requirements with a couple of clicks. It's not possible to add/remove/modify collections in liquid templates. You'd need to make API calls to make those changes. As far as I'm aware anyway. 

0 Likes
Highlighted
New Member
1 0 0

Did you ever figure this out?  I came here searching for the same solution!

0 Likes
Highlighted
Shopify Partner
88 3 10

Hello! I think our app Advanced Collections - https://apps.shopify.com/advanced-custom-collections - can help.

 

For this use case, in the app interface, you can create a collection that includes products with total inventory more than 0 and exclude products with total inventory more than 2. For this option, the app will sum up all the inventory quantities in all the variants in order to do the comparison. It acts just like a normal Shopify collection (so you can apply discount code / add to navigation etc), just that it auto-syncs when you add / update a product in your shop.

 

0 Likes