min/max

Returns the minimum or maximum value of a numeric inventory attribute among all items generated by an inventory template.

For example, if a template is scoped to products with different prices, use one of these functions to return just one price. If you don't care about minimum or maximum value, you can use any(ATTRIBUTE) instead.

Syntax

min(ATTRIBUTE)

max(ATTRIBUTE)

Learn more about syntax for functions.

Parameter

  • ATTRIBUTE: A numeric inventory attribute.
    You can specify a standard attribute such as ITEM_PRICE or a custom attribute. Learn more about referring to inventory attributes.

Examples

  • The following function in an ad template returns the lowest price of all items in an ad group:
    "Prices as low as " & [to_string(min(INVENTORY_ITEM_SALE_PRICE))]
  • The following function in an ad template returns the highest sale price of all items in an ad group:
    "Never pay more than " & [to_string(max(ITEM_PRICE))]
Was this helpful?
How can we improve it?