Price
Last updated
Was this helpful?
Last updated
Was this helpful?
To show strikethrough pricing and/or badges in collections, you must edit the theme to ensure that each product in a collection has:
a price that is marked
Displaying strikethrough pricing for products in a collection requires that data attributes are configured. Read to learn how to set up the required data attributes.
The script will look for Discount Ninja price sections on a page.
The script will then, for each price, find the HTML parent that includes . 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.
Place the la-dn-price
attribute on the HTML element that spans all of the following:
The section of the theme that renders the standard price of the variant when the variant is not on sale (i.e. the variant does not have a compare-at price in Shopify)
The section of the theme that renders the discounted price of the variant when the variant is on sale (i.e. the variant has a compare-at price in Shopify)
And, if applicable:
The “Sold out” text displayed if the variant is out of stock
The “Sale” badges displayed if the variant has a compare at price
Ensure the attribute class is not placed on a section that renders HTML that is not related to the price, such as:
Review widgets
Installments
since all content in the section with the above attribute is replaced with the discounted price when the variant is discounted through Discount Ninja.
Use the following snippet to add the data attribute in a Liquid template:
The style (font, color, size) as well as the format (strikethrough or not, price first or compare-at price first...) can be configured in the app.
In the menu go to Settings > Dynamic Pricing > Price format.
By default the price of the first available variant is used. The lowest price variant is used instead when the data-la-dn-product-price-varies
attribute is set to true
.
To use the price of a different variant:
set the price
and compare-at-price
attributes to the values of the variant you want to display prices for
alternatively, provide the id of the variant in the data-la-dn-product-variant
attribute. The app will then override the price
and compare-at-price
with the price of the variant
.
When products have variants with different prices, the price-varies
attribute should be set to true
. This causes the app to show the price of the product as follows "From price-min
" where price-min
is the lowest price of any variants of the product (example: from $25.95) . This behavior can be disabled in the app. The "from" label can also be changed or translated in the app.
If the selected product variant is unavailable, the available
attribute should be set to false
. This causes the app to show a "Sold out" label. This behavior can be disabled in the app. The "sold out" label can also be changed or translated in the app.
The collection price shows a single price per product (by default the price of the variant with the lowest price). The app cannot display a price per variant on the collection page. Variants with different prices are supported on product pages.
The app does not support:
The concept of “Unit price” (discounted prices cannot be displayed for unit prices)
Different prices for products per Market
The following articles provide details for the apps that Discount Ninja integrates with:
Discount Ninja can render strikethrough pricing on collections that are managed by other apps. See for more information.
(formerly known as PFS)
r (SPF)
(Ultimate Search)