Attributes
The term collections is used to refer to collection pages (Product Listing Page or PLP) as well as lists of products displayed on any other page. For example, collections can be included on a home page or a Product Detail Page (PDP).
Mechanism
The script will look for Discount Ninja price sections on a page that are marked.
The script will then, for each price, find the HTML parent that includes data attributes. If data attributes are found, the product is assumed to be part of a collection.
The script can then apply strikethrough pricing to each of the products in the collection that it has detected.
Location
On collection pages, Discount Ninja needs information about the products that are rendered in the collection.
To provide the necessary context, add the data attributes to the element that spans:
The section that renders the collection product image
The section that renders the collection product price
Minimum requirement
The data-la-dn-product-handle
is mandatory. It is highly recommended to include all attributes though.
The app executes a network request for every product that does not include all attributes, unless it can obtain the information through a different mechanism. This can impact the performance of the online store. It is therefore important to include all attributes to achieve optimal performance.
Snippet
Use the following snippet to add the data attributes in a Liquid template:
The attributes in the snippet make reference to a variable named product
. For example {{ product.handle }}
.
It is possible that the theme uses a different variable name, for example: product_item
. If this is the case, you need to change all occurrences of the variable to the correct variable name, for example: {{ product_item.handle }}
.
Example
Attributes
All attributes must be prefixed data-la-dn-product-
Attribute | Data type | Notes |
---|---|---|
|
| The handle of the product. |
|
| The ID of the product. |
|
| A comma-separated list of collection handles indicating which collections the product belongs to.
Use |
|
| A comma-separated list of collection IDs indicating which collections the product belongs to.
Use |
|
|
|
|
| The price (in cents) of the first available variant of the product. This should align with the title and image displayed. |
|
| The compare-at price (in cents) of the first available variant of the product. This should align with the title and image displayed. |
|
|
|
|
|
|
|
| The lowest price (in cents) of any variants of the product. This price is displayed when |
|
| A comma-separated list of tags of the product.
Use |
|
| [Optional] The id of the variant in this attribute. If omitted the price of the first available or lowest priced variant is used. See the section on variant price. |
Last updated