Script editor: line items scripts - get product collection

New Member
2 0 0

I need to implement a logic, where customer gets discount if he byes X or more items from the same collection

Thried to do it using line item script from shopify plus functionality, but wasn't able to find the approipriate product data in the line_items collection

Coldn't find anything about product collections in shopify scripts documentation

How can I get collections line_item belongs to?

66 0 28

Short answer: you can't, I'm afraid. Whether a product is part of a particular collection can't be accessed from within a Shopify Script.

What you'll have to do is look at the logic behind the collection itself (tags, product vendor, et cetera) and replicate that logic inside your Shopify script to determine if an item is eligible for a discount or not.

Author of and
New Member
2 0 0

Thanks, Gavin.

4 0 2

Hi Gavin,

How about trying to determine whether a product is 'manual' fulfillment or dropship in Scripts?

I can determine product fulfillment type in Order Printer using "line_item.fulfillment_service":

{% unless line_item.fulfillment_service == 'manual' or stockquantity > 2 %}
                This item ships from another warehouse<br/>            
{% endunless %}

However, I don't see this possible using the provided methods in Shopify Scripts.  Our goal is to hide a particular shipping option when the fulfillment service is not 'manual'

It doesn't look like this is something I can access in scripts, but it's entirely possible I'm missing something.  

Hmmm... I could make fulfillment type a line item property via hidden form on the PDP (populated with fulfilment service) and add through the add to cart button.  That should make it available in scripts.   I will try this.

Any other thoughts?