[Version 1] Set up Dynamic Pricing for Collections

Learn how to make the necessary changes to your theme files to enable Dynamic Pricing on collection pages

Bart Coppens avatar
Written by Bart Coppens
Updated over a week ago

NOTE: This article is deprecated, please refer to the section "Setting up Dynamic Pricing" for an up to date version of this article that applies for the latest version of Discount Ninja

Find your product template

  • Click on "Online Store" in your Sales Channels in the Shopify admin.

  • Then click Themes.

  • From the Action menu on the right, select "Edit code".

  • Next, find the template used to display a product in a collection in the Templates, Sections or Snippets folder. You're looking for the file that contains the markup that displays a card of the product with its price on the collection page.

Take a backup

  • Copy the content of the template before you make any changes. Create a separate file and paste the content. Repeat for every file you plan to change. Better safe than sorry!

Add data

  • On the div or span that includes the price, add the following data attributes: data-limoniapps-discounturl-product-handle="{{ product.handle }}" data-limoniapps-discounturl-product-price="{{ product.price_min }}" data-limoniapps-discounturl-product-compareatprice="{{ product.compare_at_price_max }}"

  • The end result looks something like this:

...
<div class="..." id="..." data-limoniapps-discounturl-product-handle="{{ product.handle }}" data-limoniapps-discounturl-product-price="{{ product.price_min }}" data-limoniapps-discounturl-product-compareatprice="{{ product.compare_at_price_max }}">
 ... (includes price information)
</div>

Change the product price

  • Add the necessary markup for the product price here too.

  • Follow the same procedure you followed for the product price on product pages, outlined here.

Rinse and repeat

Repeat this procedure for all other collections or product cards (used in a menu or on the home page for example) for which you wish to show discounted prices.

Test

  • Save all files and test!

Did this answer your question?