[Version 1 ] Set up Dynamic Pricing for Products

Learn how to make the necessary changes to your theme files to enable Dynamic Pricing on product pages (applies to Discount Ninja Version 1)

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 your product template in the Templates, Sections or Snippets folder. You're looking for the file that contains the markup that displays the price on the product page.

  • Search the file (use CTRL+F when inside the code panel) for the following text: .price | money. You should find one or more blocks of markup that look similar to this: {{ product.price | money }} (where product could be a different name such as current_variant or other).

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!

Wrap markup around the 'price section'

  • Find the section that includes your price logic.

  • This means all of html that shows prices and compare at prices and sales tags...

  • Wrap the entire section into a span with class limoniapps-discount-url-productprice.

  • This goes in front: <span class="limoniapps-discount-url-productprice">.

  • And this goes at the end: </span>.

  • The end result is something like: 

<span class="limoniapps-discount-url-productprice">
...
divs and spans related to showing {{ variant.price | money }} and  {{ variant.compare_at_price | money }}
...
</span>

Optionally: Add markup around sections you want to hide

  • Only needed in the unlikely case that anything outside of the <span class="limoniapps-discount-url-productprice"> you created above needs to be hidden after Discount Ninja shows the discounted price.

  • Put <span class="limoniapps-discount-url-productprice-hideafterreplace"> before that block and </span> after that block.

  • The end result is something like: <span class="limoniapps-discount-url-productprice-hideafterreplace">... some price related markup...</span>

Test

  • Save all files and test!

Did this answer your question?