Line Items and Fulfillment in Order Packing Slip

Hello,

I’m trying to customise the packing slip - the template when you fulfill an item.

I’d like to have 3 sections on the packing slip:

  1. Items which are being fulfilled in this shipment.

  2. Items that still need to be fulfilled at a later date.

  3. Items that have already been fulfilled.

For the first sections, I am referencing the line item by using {% for line_item in line_items_in_shipment %}, which works perfectly fine. However, I’m not sure which objects/variables to use for the second and third sections.

Can anyone help please?

Thank you!

hello there

To display items that still need to be fulfilled at a later date on the packing slip, you can use the line_items_not_in_shipment object. This object contains an array of line items that have not yet been fulfilled for the order.

To display items that have already been fulfilled, you can use the fulfilled_line_items object. This object contains an array of line items that have already been fulfilled for the order.

Here’s an example of how you can display all three sections on the packing slip:


{% for line_item in line_items_in_shipment %}
  {{ line_item.title }} - {{ line_item.quantity }}

{% endfor %}

{% for line_item in line_items_not_in_shipment %}
  {{ line_item.title }} - {{ line_item.quantity }}

{% endfor %}

{% for line_item in fulfilled_line_items %}
  {{ line_item.title }} - {{ line_item.quantity }}

{% endfor %}

This code loops over the line_items_in_shipment, line_items_not_in_shipment, and fulfilled_line_items objects and outputs the title and quantity of each line item in a separate div element for each section.