Ad

What Is The Variable And Format For Fulfillment Quantity In Shopify

- 1 answer

I am using the variable {{ line_item.fulfillment }} to show the quantity shipped/fulfilled of any given line item on an order but it shows as "FulfillmentDrop".

What is the real variable for quantity shipped/fulfilled and what is the format?

Amendment:

Here is my code block as it appears in Shopify's "Order Printer" app:

{% for line_item in line_items %} <tr> <td style="border: none;">{{ line_item.sku }}</td> <td style="border: none;">{{ line_item.title }}</td> <td style="border: none; text-align: center;">{{ line_item.quantity }}</td> <td style="border: none; text-align: center;">{{ line_item.fulfillment.item_count }}</td> </tr> {% endfor %}

Ad

Answer

Based on official documentation https://help.shopify.com/themes/liquid/objects/line_item#line_item-fulfillment

line_item.fulfillment Returns the fulfillment of the line item.

That means, that in your case if you want to receive fulfilled quantity per line item, you should use {{ line_item.fulfillment.item_count }}

For order printer app in theory this should work, but it is not working for some reason

{% assign fulfilled_quantity = 0 %} {% for f_line_item in fulfilled_line_items %} {% if f_line_item.name == line_item.name %} {% assign fulfilled_quantity = f_line_item.quantity %} {% endif %} {% endfor %} {{ fulfilled_quantity }}

f_line_item.quantity the variable is always returning full quantity even if you fulfilled partially. I think it is better to ask Shopify support

Ad
source: stackoverflow.com
Ad