Comment on page
Component
render
: renders the banner(s) based on the messages received- Parameters:
message (object)
:token (string) [required]
: the token of the associated Discount Ninja offeravailable
:- indicates if the product variant is in stock (
true
) or out of stock (false
) - default value:
true
location ("product-page" | "collection" | "drawer-cart" | "cart") [required]
: The location where the price is displayed- Attributes required for location
collection
:productHandle (string)
: the message is intended for placeholders with a matchingproduct-handle
attribute
- Attributes required for location
product-page
:productHandle (string)
: the message is intended for placeholders with a matchingproduct-handle
attributevariantId (number | null)
: if available, the message is intended for placeholders with a matchingvariant-id
attribute; whenvariantId
is available, the component disregardsproductHandle
- Attributes required for locations
cart
anddrawer-cart
level ("product" | "line" | "total")
: the message is intended for placeholders with a matchingline-item-key
attributeline-item-key (string) [required if level is "product" or "line")
: the message is intended for placeholders with a matchingline-item-key
attribute
discounted
:- indicates if the product variant is discounted (
true
) or not (false
) - default value:
false
- Attributes when discounted is
false
:price (number) [required]
: theprice
variable
- Attributes when discounted is
true
:price (number) [required]
: theprice
variablecompare-at-price (number)
: thecompare-at-price
variablemsrp (number)
: themsrp
variableunit-price (number)
: theunit-price
variablecompliance-price (number)
: thecompliance-price
variable
- Template content attributes:
- header (string)
- footer (string)
- price-prefix (string)
- price-suffix (string)
- compare-at-price-prefix (string)
- compare-at-price-suffix (string)
- unit-price-prefix (string)
- unit-price-suffix (string)
- msrp-prefix (string)
- msrp-suffix (string)
- compliance-price-prefix (string)
- compliance-price-suffix (string)
- Product variant 123456 should be marked as out of stock on the product page
{
token: "ABCD",
location: "product-page",
variant-id: 123456,
available: false
}
- Product variant 123456 is not discounted, its price should display as $120 on the product page
{
token: "ABCD",
location: "product-page",
variant-id: 123456,
discounted: false,
price: 12000
}
- Product variant 123456 is discounted, its price should display as $100 on the product page, with a compare-at price of $120
{
token: "ABCD",
location: "product-page",
variant-id: 123456,
discounted: true,
price: 10000,
compare-at-price: 120000
}
- Product variant 123456 is discounted, its price should display as $100 on the product page, with an MSRP of $180
{
token: "ABCD",
location: "product-page",
variant-id: 123456,
discounted: true,
price: 10000,
msrp: 180000
}
- Cart line item 1 is discounted, its product price should display as $100 on the drawer cart, with a compare-at price of $120 and a suffix showing "You save $20"
{
token: "ABCD",
location: "drawer-cart",
level: "product"
line-item-key: 123456,
discounted: true,
price: 10000,
compare-at-price: 120000
compare-at-price-suffix: "You save $20"
}
- The product with handle "my-product-handle" is discounted, its price should display as $100 in collections, with a unit price of $1.59
{
token: "ABCD",
location: "collection",
product-handle: "my-product-handle",
discounted: true,
price: 10000,
unit-price: 159
}
- The subtotal of the cart is discounted, its price should display as $200 in the drawer cart, with a compare-at price of $250, the footer should display "You save 20%"
{
token: "ABCD",
location: "drawer-cart",
level: "total",
discounted: true,
price: 20000,
compare-at-price: 250,
footer: "You save 20%"
}
la:dn:product-banner:render
- Executes the
render
method.
Last modified 2mo ago