Storefront data
Discount Kit Live makes your discount data instantly accessible through metafields using an app-specific namespace.
Accessing discount data
Section titled “Accessing discount data”Discount data is available through metafields on products, collections, and
the shop object using the namespace app--9549316097--discount_kit and key
discounts.
Product-level discounts
Section titled “Product-level discounts”Access all discounts that apply to a specific product, including discounts inherited from collections the product belongs to. Gift with purchase discounts are the exception: they’re listed on the shop only (see Free gift with a product).
{% assign discounts = product.metafields.app--9549316097--discount_kit.discounts.value %}
{% if discounts.size > 0 %} {% for discount in discounts %} <div class="discount"> <h3>{{ discount.discount_title }}</h3> <span>{{ discount.maximum_reward_value }}% OFF</span> </div> {% endfor %}{% endif %}Collection-level discounts
Section titled “Collection-level discounts”Access discounts that target a collection directly. Note that these discounts are also fanned out to every product in the collection, so you typically only need collection metafields for collection page banners:
{% assign discounts = collection.metafields.app--9549316097--discount_kit.discounts.value %}
{% if discounts.size > 0 %} <div class="collection-promo"> <p>{{ discounts.first.discount_title }}</p> </div>{% endif %}Shop-level discounts
Section titled “Shop-level discounts”Access all active discounts across your store:
{% assign all_discounts = shop.metafields.app--9549316097--discount_kit.discounts.value %}
{% if all_discounts.size > 0 %} <div class="site-wide-promos"> {% for discount in all_discounts %} <div>{{ discount.discount_title }}</div> {% endfor %} </div>{% endif %}Free gift with a product
Section titled “Free gift with a product”Gift with purchase discounts are listed on the shop only. A GWP discount reads as 100% off — true of the gift, not of the products a shopper buys to earn it — so it stays off product and collection lists, where a badge or sale price would take that figure for the product’s own.
To tell shoppers a product earns a gift, find the GWP discounts on the shop
list and check the product against each one’s threshold_product_references:
{% assign all_discounts = shop.metafields.app--9549316097--discount_kit.discounts.value %}{% assign gift_discounts = all_discounts | where: 'discount_type', 'GWP' %}
{% for discount in gift_discounts %} {% for qualifying in discount.threshold_product_references.value %} {% if qualifying.id == product.id %} <p class="gift-promo">Free gift with this product: {{ discount.discount_title }}</p> {% break %} {% endif %} {% endfor %}{% endfor %}A GWP that qualifies on a collection names it in
threshold_collection_references instead; compare those against
product.collections the same way.
DiscountSummary object
Section titled “DiscountSummary object”Each discount in the array is a DiscountSummary metaobject with fields like:
discount_title— Display namediscount_type— Type (PRODUCT_VOLUME, ORDER_GOAL, GWP, etc.)method—'automatic'or'code'code— The discount code (empty for automatic discounts)tags— Tags applied to the discount in Shopify (dk:livewhere you added it, plus any merchant tags)reward_type— PERCENTAGE, FIXED_AMOUNT, or FIXED_PRICEmaximum_reward_value— Top tier discount valueincluded_markets— Market handles where applicableincluded_customer_tags— Required customer tagscart_attribute_key— Cart attribute key required to apply
Quick access: best discount value
Section titled “Quick access: best discount value”For simple use cases where you just need to display the best discount value, Discount Kit provides scalar metafields that are easier to work with than parsing the full discount array.
Available metafields
Section titled “Available metafields”| Metafield | Type | Description |
|---|---|---|
max_reward_percent |
number_decimal |
Best percentage discount (e.g., 20 for 20% off) |
max_reward_cents |
number_integer |
Best fixed-value reward in cents (discount amount or final price, e.g., 500 for $5 off or 1500 for a $15 final price) |
max_reward_discount |
metaobject_reference |
Reference to the full DiscountSummary for additional details |
Product example
Section titled “Product example”{% assign percent_off = product.metafields.app--9549316097--discount_kit.max_reward_percent.value %}{% assign cents_off = product.metafields.app--9549316097--discount_kit.max_reward_cents.value %}
{% if percent_off > 0 %} <span class="badge">{{ percent_off | round }}% OFF</span>{% elsif cents_off > 0 %} <span class="badge">{{ cents_off | divided_by: 100.0 | money }} OFF</span>{% endif %}Collection example
Section titled “Collection example”{% assign percent_off = collection.metafields.app--9549316097--discount_kit.max_reward_percent.value %}
{% if percent_off > 0 %} <div class="collection-badge"> Save up to {{ percent_off | round }}% </div>{% endif %}Accessing the full discount details
Section titled “Accessing the full discount details”Use max_reward_discount to get additional info like the discount title or
message:
{% assign best_discount = product.metafields.app--9549316097--discount_kit.max_reward_discount.value %}
{% if best_discount %} <div class="promo"> <strong>{{ best_discount.discount_title }}</strong> <span>{{ best_discount.maximum_reward_value | round }}% OFF</span> </div>{% endif %}Performance
Section titled “Performance”Metafield access is instant with zero overhead:
- No API calls — data is already on the page
- Server-rendered — available during initial render
- Always up-to-date — synced automatically
Next steps
Section titled “Next steps”Filtering, the complete DiscountSummary reference and copy-paste examples are being migrated to these docs; see Introduction for how Live syncs in the meantime.