Articles on: Lably

Show the discount or stock left on a label with dynamic values

Show the discount or stock left on a label with dynamic values


In this article:


A dynamic value is a placeholder in the label text that Lably replaces with each product's own data. Write the label once, for example "Only {{product.inventory_quantity}} left", and every product shows its own number: "Only 3 left", "Only 12 left".


What dynamic values do


Lably has five dynamic values. They work in labels and badges:


Dynamic value

Code

Example on the store

Product inventory quantity

{{product.inventory_quantity}}

Only 3 left

Variant inventory quantity

{{product.variant_quantity}}

Only 2 left

Discount %

{{product.save_percent}}

SAVE 50%

Discount amount

{{product.save_amount_without_currency}}

SAVE $50.00

Product metafield

depends on the metafield

100% cotton


For metafields, see Use product metafields in label text and display conditions.


Add a dynamic value to a label


  1. Open the label and go to Label.
  2. Make sure the type is Text.
  3. Click the { } button (Dynamic value) at the end of the Text field.
  4. Select a value from the list.




  1. Edit the text around the code if needed, for example Only {{product.inventory_quantity}} left.
  2. Click Save.


The preview in the editor uses a sample number, so it shows "Only 3 left" for every product. Your store shows the real numbers.




Add discount values from the list. Stock codes can also be typed by hand, for example {{product.inventory_quantity}}, with both curly braces on each side.


Show how many items are left


There are two stock values. Choose the one that fits your products:


  • Product inventory quantity {{product.inventory_quantity}}: the total stock of all variants of the product. It works everywhere: on the product page, on collection cards and on the home page. Use it for most stores.
  • Variant inventory quantity {{product.variant_quantity}}: the stock of one variant, for example "Blue / M". It works only on the product page, for the variant that is selected when the page opens. On collection cards the number stays empty, and it doesn't change when the customer selects another variant.




The numbers come from Inventory in your Shopify admin. Keep in mind:


  • A product that doesn't track inventory shows 0.
  • A product that was sold below zero shows a negative number, for example "Only -1 left".


To avoid these cases, show the stock label only on products that have a positive stock and are running low. See Show the label only on the right products.


Show the discount


The discount values use the Compare-at price of the product:


  • Discount %: (Compare-at price − Price) ÷ Compare-at price × 100. A product with Price $399 and Compare-at price $499 shows SAVE 20%.
  • Discount amount: Compare-at price − Price. A product with Price $350 and Compare-at price $560 shows SAVE $210.00.


The discount values already include the % sign and the currency, so don't add them to the text yourself. A label with a discount value appears only on products that have a compare-at price higher than the price.


When you select Discount % or Discount amount from the list, Lably replaces the whole label text with a ready template, for example SAVE {{product.save_percent}}. Change "SAVE" to your own word if you like.


For products with variants, Lably uses the selected variant. If no variant is selected, it uses the first available variant.


Show the label only on the right products


A stock value doesn't choose the products: without a condition, the label appears on every product, even on products with plenty of stock. Add a display condition in the Display Conditions block:


Low stock label ("Only 3 left"):


  1. Click Add condition and select Product inventory.
  2. Select Stock availability is less than and enter a number, for example 10.
  3. Click Add condition again, select Product inventory, select Stock availability is greater than and enter 0.
  4. Next to Products must match, select All.




Now the label appears only on products that have 1 to 9 items left.


Use Stock availability is greater than 0 rather than In stock. In stock follows the product's availability in Shopify, so it also lets through products that don't track inventory and products that were oversold. Those would show "Only 0 left" or a negative number.


Discount label for big sales only ("SAVE 35%"):


  1. Click Add condition and select Discount percentage.
  2. Select Is greater than and enter 30.


The label appears only on products with a discount bigger than 30%, and each shows its own discount.


For a variant-level rule, use the Variant inventory condition. It has All variants and Any variant options, for example "show the label if any variant has fewer than 5 items".


The other matchers for discount conditions are Is equal to, Is not equal to, Is greater than or equal to, Is less than, Is less than or equal to, Is in range, Is not in range, Is empty and Is not empty.


✔️ Next step


Check our articles to learn more about the app's functionality:


Updated on: 21/10/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!