Metafield reference
All fields are on the product owner, namespace storeai. Sales fields need the autopilot merchandiser on for a collection containing the product; facts come from Catalog Studio and Snap to Shelf.
| Key | Type | Value |
|---|---|---|
storeai.badges | json | List of up to two strings, like ["#1 in Hoodies", "Selling fast"]. Empty list when none apply |
storeai.velocity | number_decimal | Average units sold per day over the last 30 days, like 3.47 |
storeai.trend | number_decimal | Last 7 days' pace divided by the 30-day pace. 1 is steady, above 1 is rising |
storeai.days_of_stock | number_integer | Days the current stock lasts at the 30-day pace. 999 when not selling. Absent when stock isn't tracked |
storeai.margin | number_decimal | (price − cost) ÷ price, from 0 to 1, like 0.62. Absent without cost per item |
storeai.facts | json | List of { "name", "value" } product facts, like Material or Fit |
Badges on product pages
The no-code route is the StoreAi badges app block. To place them yourself, for example in sections/main-product.liquid:
{%- comment -%} Render with {% render 'storeai-badges', product: product %} {%- endcomment -%}
{%- assign badges = product.metafields.storeai.badges.value -%}
{%- if badges and badges.size > 0 -%}
<ul class="storeai-badges" role="list">
{%- for badge in badges limit: 2 -%}
<li class="storeai-badge">{{ badge | escape }}</li>
{%- endfor -%}
</ul>
{%- endif -%}Badges on product cards
The StoreAi badges on cards app embed labels cards on collection and search pages automatically. In a theme you control, print the first badge in the card snippet instead. In Dawn and its forks that's snippets/card-product.liquid:
{%- assign storeai_badges = card_product.metafields.storeai.badges.value -%}
{%- if storeai_badges and storeai_badges.size > 0 -%}
<span class="badge storeai-card-badge">{{ storeai_badges.first | escape }}</span>
{%- endif -%}Stock and speed messages
Use the numbers for your own honest messages. For example, a low-stock note that only shows when it's true:
{%- assign days = product.metafields.storeai.days_of_stock.value -%}
{%- assign speed = product.metafields.storeai.velocity.value -%}
{%- if days and days > 0 and days < 7 -%}
<p class="stock-note">Selling quickly: at the current pace this sells out in about {{ days }} days.</p>
{%- elsif speed and speed >= 1 -%}
<p class="stock-note">About {{ speed | times: 7 | round }} sold in a typical week.</p>
{%- endif -%}Product facts
Print the facts StoreAi keeps as a specification list. The same list feeds the structured data app embed as additionalProperty:
{%- assign facts = product.metafields.storeai.facts.value -%}
{%- if facts and facts.size > 0 -%}
<dl class="product-facts">
{%- for fact in facts -%}
<div>
<dt>{{ fact.name | escape }}</dt>
<dd>{{ fact.value | escape }}</dd>
</div>
{%- endfor -%}
</dl>
{%- endif -%}[
{ "name": "Material", "value": "100% European linen" },
{ "name": "Fit", "value": "Runs half a size large" },
{ "name": "Care", "value": "Machine wash cold" }
]Reading them through the API
The same values are available to headless storefronts and your own tools. With the Admin GraphQL API:
query StoreAiFields($id: ID!) {
product(id: $id) {
title
metafields(namespace: "storeai", first: 10) {
nodes { key type value }
}
}
}Theme blocks at a glance
| Block | Type | Where |
|---|---|---|
| StoreAi badges | App block | Product template, any section that accepts app blocks |
| StoreAi badges on cards | App embed | Collection and search pages; labels cards by their product link |
| StoreAi structured data | App embed | Adds Product JSON-LD to product pages, merged by @id |
Turn app embeds on in the theme editor under App embeds. See storefront badges and AI-ready product data for what each one shows.
Questions
- Can I write to the storeai metafields myself?
- You can, but StoreAi overwrites sales fields and badges on the next sort. Put your own data in your own namespace.
- Are the metafields removed when StoreAi is uninstalled?
- App data is deleted when you uninstall. Metafields already on your products stay until you remove them, so your theme won't break; they simply stop updating.