Datima.ai

Guides · 4-minute read

Show the best-before date on your product page.

Add the Best before theme block in Shopify's theme editor, its settings, how it follows the selected variant, the markdown line, and the metafield it reads.

What shoppers see

A line under the price: Best before 7 Nov 2026. Inside a window you choose — 30 days by default — it adds Use soon. On a product without a recorded date the block shows nothing at all, so it can sit on every product page without a gap. While an automatic markdown runs, it adds the reason: Was $4.50 · short-dated, best before 5 Oct 2026, or the percentage when the product has its own compare-at price.

A storefront product page on a sample theme: the price, and under it the Best before block saying Best before 12 Oct 2026, use soon.
An illustration on a sample theme, with the block's real wording.

Add the block

No code. In your Shopify admin go to Online Store → Themes → Customize, open a product page, choose Add block in the product information section and pick Best before under Apps. Drag it where you want it — most stores put it right under the price — and Save. Themes built on Online Store 2.0 (Dawn and its relatives) all take app blocks; if yours does not offer Add block, it is an older theme.

Settings

SettingWhat it does
Show labelShows or hides the words before the date.
LabelYour own words instead of Best before — Use by, Expires, Freshest until.
Date formatShort (7 Nov 2026), long (7 November 2026) or ISO (2026-11-07).
“Use soon” windowDays before the date within which the note appears; 0 to 90, 30 by default. 0 turns it off.
“Use soon” textYour own words for the note.
Show the markdown lineThe Was … · short-dated line while a price is reduced. On by default.
Advanced: namespace, keyWhich metafield the block reads. Leave at expiry / earliest_expiry unless you have moved it.

Variants

The block follows the variant the shopper selects. Pick the 500 g size and it shows that variant's date; pick the 1 kg and it changes, without a page reload, in themes that swap the price the same way. Each variant's date is its earliest batch with stock.

Language

The block's words come in your theme's languages — English, German, French and Spanish — and the date follows the storefront locale. The label and the “use soon” text you type are yours and stay as typed.

While a price is reduced

A storefront product page while a markdown runs: the reduced price with the regular price struck through, and the Best before block saying: Best before 12 Oct 2026, use soon; Was $4.50, short-dated, best before 12 Oct 2026.
The shopper sees the price, and the block says why.

When automatic markdowns lower a price, the block explains it on the same line, so a lower price never looks like a mistake. The struck-through regular price above it is your theme's compare-at display; the markdown rules can fill compare-at while a markdown runs so that it shows.

The metafield behind it

The block reads one thing: the variant metafield expiry.earliest_expiry, which Datima keeps current as batches are added, sold and zeroed. Anything else in your store can read it too — a Shopify Flow that tags products expiring within a month, a packing-slip app, a custom section. Removing the app removes the block and stops updating the metafield.

Questions? support@datima.ai · Last updated 14 October 2026