A shopper looking at a tub of yoghurt, a jar of sauce or a bag of coffee wants one answer before the cart: how long will this keep? If the date lives only in your warehouse system, the shopper has to guess, and a short-dated item with a markdown can look like a mistake. Datima Expiry Management ships a theme block, Best before, that puts the date under the price and keeps it right when the shopper picks another size. This guide covers how to add it, which settings matter for a food shop, and what to check on your own theme. It follows the app’s current guide, Show the best-before date on your product page, last updated 14 October 2026 and checked for this article on 27 November 2026. The examples are illustrative, not results from a store.
What the block shows
The block adds one line under the price, such as Best before 7 Nov 2026. Three things can be added to it:
- A Use soon note when the date falls inside a window you choose. The window is 30 days by default, from 0 to 90 days, and 0 turns the note off.
- The reason for a lower price while an automatic markdown is running, in a line such as Was $4.50 · short-dated, best before 5 Oct 2026. If the product has its own compare-at price, the line shows the percentage instead.
- Nothing at all on a product with no recorded date. The block can sit on every product page without leaving a gap on the products you do not track.
The date comes from the earliest batch of that variant that still has stock. Datima keeps it in a variant metafield, expiry.earliest_expiry, and updates it as batches are added, sold and zeroed. If you have no batches recorded yet, start with recording batch expiry dates in Shopify.
Step 1: add the block to the product page
- In the Shopify admin, open Online Store → Themes → Customize and choose a product page template.
- In the product information section, choose Add block and pick Best before under Apps.
- Drag it where you want it. The guide says most stores put it right under the price.
- Save.
The guide says themes built on Online Store 2.0 take app blocks, and that a theme which does not offer Add block is an older theme. It names Dawn as an example. It does not promise that every theme looks the same, so check the result on your own storefront rather than assuming it matches the guide’s sample.
Step 2: set it up for how you sell
| Setting | What it does | A reasonable choice to try |
|---|---|---|
| Label | Your words instead of “Best before” | “Use by” for chilled items, “Freshest until” for coffee: pick the phrase that matches your packaging |
| Date format | Short (7 Nov 2026), long (7 November 2026) or ISO (2026-11-07) | Short or long: shoppers read them more easily than ISO |
| “Use soon” window | Days before the date within which the note appears | Shorter for a product that keeps a week, longer for one that keeps months |
| “Use soon” text | Your words for the note | Something plain, such as “Best enjoyed soon” |
| Show the markdown line | The “Was … · short-dated” line during a markdown | Leave on, so a reduced price comes with its reason |
The label should match the date you enter on the batch. If your packaging says “use by” for safety and you enter a best-before date, the label does not change what the date means. Datima records the date you give it and does not decide which kind of date a product needs.
Why the variant matters
Take an illustrative jar of sauce sold in 250 g and 1 kg sizes. The two sizes come from different production runs, so they have different dates:
| Variant | Earliest batch with stock | What the block shows |
|---|---|---|
| 250 g | 12 Dec 2026 | Best before 12 Dec 2026 |
| 1 kg | 3 Dec 2026 | Best before 3 Dec 2026, and Use soon when inside the window |
A shopper who opens the product page lands on the first variant, then switches to 1 kg. The date should change with the size, because it is a different jar from a different batch. The guide says the block follows the selected variant and changes without a page reload in themes that swap the price the same way.
That last condition is the one to test. Some themes re-render parts of the product page when the variant changes and leave app blocks as they were first painted. Datima’s block carries every variant’s words with it and swaps them itself, so it does not depend on the theme re-rendering it. Whether it behaves identically on your theme is something to confirm in the check below, not assume.
When a markdown is running
If you use automatic markdowns for short-dated stock, the block explains the lower price on the same line. 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 appears. The same markdown also puts a tag on the product, which you can use for a Clearance collection that fills and empties itself. Turn Show the markdown line off if you would rather show only the date.
Edge cases
- No date recorded. The block shows nothing. If a product you expected to show a date is blank, check that it has a batch with stock and an expiry date.
- A batch with no date. It does not give the variant a date. See batches without an expiry date.
- A date changes after a sale. The date shown is the earliest batch with stock. When that batch sells out, the next batch’s date takes over, so the line moves later without anyone editing it.
- Language. The block’s own words come in English, German, French and Spanish, and the date follows the storefront locale. Words you type into Label or Use soon text stay as typed, so translate those yourself if you sell in more than one language.
- Other uses of the date. The same metafield can be read by a Shopify Flow, a packing-slip app or a custom section. That is optional and outside this article.
A short check you can run
- Pick a product with two variants, each with a batch and a different expiry date.
- Add the block in the theme editor and open the live product page.
- Switch between the variants and read the date each time. It should change with the variant, and the page should not reload.
- Open a product with no recorded date. The block should show nothing.
- On a product inside a markdown tier, confirm the “Was … · short-dated” line appears and reads sensibly next to your theme’s price.
- Open the page on a phone and check the line wraps cleanly under the price.
These steps describe what the guide says should happen. This article does not report that someone has run them on a particular store or theme.
Next step
Add the block to one product template, choose your label and window, and check it on a product with two dated variants. If you have not set up batches yet, the getting-started guide gives the shortest path. The block makes the date visible; it does not decide whether a product is safe to sell, and it makes no promise about sales.