Metafields on packing slip

Topic summary

A user is experiencing an issue with metafields displaying incorrectly on packing slips for multi-product orders.

The Problem:

  • Single-product packing slips correctly show unique warehouse locations for each item
  • Multi-product orders display the same warehouse location for all products instead of individual locations

Technical Details:

  • The code uses custom metafields: product.metafields.custom.fewster_warehouse_location, product.metafields.custom.curity_warehouse_location, and product.metafields.custom.oakdale
  • Labels used: FEW:, CUR:, OAK:

Code Shared:
The user posted their packing slip template code (appears reversed/encoded in the original post), which includes order details, shipping/billing addresses, and line item loops.

The issue suggests the metafield reference may not be properly scoped within the line items loop, causing it to repeat the same value rather than pulling product-specific data for each item. No solution has been provided yet.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

when i print my single product packing slip i get the accurate warehouse location for that one product

but when i pring packing slip for multiple products order, it giving me the same warehouse location for all products .

my code: Warehouse Location: FEW:{{ product.metafields.custom.fewster_warehouse_location }} CUR: {{ product.metafields.custom.curity_warehouse_location }} OAK: {{ product.metafields.custom.oakdale }}

results:

Order {{ order.name }}

{% if order.po_number != blank %}

PO number #{{ order.po_number }}

{% endif %}

{{ order.created_at | date: format: "date" }}

{% if delivery_method.instructions != blank %} Delivery to {% else %} Ship to {% endif %}

{% if shipping_address != blank %} {{ shipping_address.name }} {% if shipping_address.company != blank %}
{{ shipping_address.company }} {% endif %}
{{ shipping_address.address1 }} {% if shipping_address.address2 != blank %}
{{ shipping_address.address2 }} {% endif %} {% if shipping_address.city_province_zip != blank %}
{{ shipping_address.city_province_zip }} {% endif %}
{{ shipping_address.country }} {% if shipping_address.phone != blank %}
{{ shipping_address.phone }} {% endif %} {% else %} No shipping address {% endif %}

Bill to

{% if billing_address != blank %} {{ billing_address.name }} {% if billing_address.company != blank %}
{{ billing_address.company }} {% endif %}
{{ billing_address.address1 }} {% if billing_address.address2 != blank %}
{{ billing_address.address2 }} {% endif %} {% if billing_address.city_province_zip != blank %}
{{ billing_address.city_province_zip }} {% endif %}
{{ billing_address.country }} {% else %} No billing address {% endif %}


Items

Quantity

{% comment %}
To adjust the size of line item images, change desired_image_size.
The other variables make sure your images print at high quality.
{% endcomment %}
{% assign desired_image_size = 58 %}
{% assign resolution_adjusted_size = desired_image_size | times: 300 | divided_by: 72 | ceil %}
{% capture effective_image_dimensions %}
{{ resolution_adjusted_size }}x{{ resolution_adjusted_size }}
{% endcapture %}

{% for line_item in order.line_items %}
{% assign shippingQty = 0 %}
{% for shipment_line_item in line_items_in_shipment %}
{% if shipment_line_item.variant_id == line_item.variant_id %}
{% assign shippingQty = line_item.shipping_quantity %}
{% endif %}
{% endfor %}

{% if line_item.image != blank %}
{{ line_item.image | img_url: effective_image_dimensions | img_tag: '', 'aspect-ratio__content' }}
{% endif %}

{{ line_item.title }}
{{ line_item.sku }}
{{ line_item.variant.barcode }}
{% if line_item.variant_title != blank %} {{ line_item.variant_title }} {% if line_item.variant.barcode != blank %} {{ line_item.current_variant.barcode }} {% endif %} {% endif %} {% if line_item.sku != blank %}

{% assign product = line_item.product %}

Warehouse Location:
FEW:{{ product.metafields.custom.fewster_warehouse_location }} CUR: {{ product.metafields.custom.curity_warehouse_location }} OAK: {{ product.metafields.custom.oakdale }}

{% endif %}