Add batch details to Shopify packing slips using order metafields

You can show Freshly batch details (batch name, expiry date, location and more) on Shopify's own packing slips by reading Freshly's order metafield in the packing slip template. If you'd rather not edit Liquid, use Freshly's built-in packing slips instead. See Bulk printing packing slips.

Before you start

Turn on order metafields in Freshly:

  1. In Freshly, go to Preferences.
  2. In Order fulfillment, check Enable inventory batch metafields on customer orders.
  3. Click Save.
Enabling inventory batch metafields in Freshly> Preferences

This is part of the paid Freshly plan. Freshly writes the metafield freshly.inventory_batches  whenever batches are assigned or changed on an order. Orders from before you turned this on get the metafield the next time their batches change. More detail in Adding batch details in metafields to Shopify orders.

Add the snippet to your packing slip template

  1. In your Shopify admin, go to Settings > Shipping and delivery.
  2. In the Documents section, click Packing slip template.
  3. Find the loop that starts with {% for line_item in line_items_in_shipment %} .
  4. Inside that loop, where you want batch details to appear (for example, under the product title and SKU), paste the Liquid from this link.
  5. Click Preview template to check it, then Save. Remove any lines you don't need, such as invoice number.

Things to know

  • Shopify packing slips match batches to items by SKU. Items without a SKU won't show batch details. If two items on the order share a SKU, each will show the batches for both.
  • Each entry in the metafield also includes batch_number , line_item_id , variant_id , location_id , quantity  and created_at  if you want to show more.
  • Shopify's full list of packing slip variables is in the Shopify Help Center.

Using Shopify Order Printer instead

Shopify Order Printer templates can read order metafields with order.metafields.freshly.inventory_batches  and expose line_item.variant_id , so you can match on inventory_batch.variant_id == line_item.variant_id  instead of SKU . See Shopify's Order Printer variable reference.

Need a hand adding this to your template? Contact us at hello@getfreshly.io.

Still need help? Contact Us Contact Us