Skip to main content

Expiration Data Metafields

Also see: Notifications, Order Printing, and Packing Slips

The Product Expiration Dates app adds metafields to a product's variant(s) under the expiration_dates namespace. If the product has no variants the default variant is used.

Do not add metafield definitions in the Shopify Admin using the expiration_dates namespace with any of the below keys. This is not necessary and prevents the app from functioning correctly. Metafields set by the app are readonly and cannot be set via the Shopify Admin.

If you need to export expiration dates to external applications that only support metafield integration (and do not support JSON metafields) see the soonest_expiring key.

The following metafields are available:

KeyDescription
allocationsAn array of expiration dates and quantities assigned to the variant. The array is sorted by expiration date, soonest to latest so allocations[0] will return data for the soonest expiring date.
allocations[N].timeThe expiration date. Format is: YYYY-MM-DDT00:00. For example: 2025-01-22T00:00. Currently the time is always 00:00. This value can be formatted using the Liquid date filter
allocations[N].quantityThe remaining inventory quantity
allocations[N].batch_numberThe assigned batch number
allocations[N].location_idThe Shopify ID of the assigned location
use_withinAn object containing use within information
use_within.use_within_valueThe numeric portion of the use within data. For example, if 30 days was assigned this will contain 30.
use_within.use_within_unitThe unit of time portion of the use within data. For example, if 30 days was assigned this will contain days.
use_within.use_within_value_in_daysThe use within value in days. For example, if 6 months was assigned, this will contain 180. We use 30 days per month: 6 * 30 = 180.
bundled_inventoryAn array of the products that are in the bundle and their expiration data/batch numbers. Only set if the product is a bundle.
bundled_inventory[N].titleThe title of the bundled product
bundled_inventory[N].allocationsAn array of expiration dates and quantities assigned to the variant. Refer to allocations[N]'s documentation.
soonest_expiringString representation of the soonest expiring inventory batch. Usefull if you need to export expiration dates to external applications that only support metafield integration. Date format can be set on the settings page.
Only available under the Premium Plan