Discount Ninja Integration Guide

Here is the guide for Discount Ninja Integration with Boost Product Filter & Search app.

About Discount Ninja

1
App Information

2
Discount Ninja Integration Benefit

  • Customers filter product list and get inherited by the updated price base on the discount policy of the app.

Demo of Discount Ninja Integration

Here is our customer's store with our app and Discount Ninja integration.

Discount Ninja Integration


Instruction

Attention: The current document only works with the new front-end lib from Boost Commerce. Please read this document first to know if you are using the latest version.
1
Edit your current theme.
2
Copy the following code snippet to your clipboard:

// For boost-pfs-filter.js
'<div class="product-item--price" data-limoniapps-discounturl-product-handle="{{itemHandle}}" data-limoniapps-discounturl-product-price="{{itemPriceMin}}" data-limoniapps-discounturl-product-compareatprice="{{itemCompareAtPriceMax}}">' +
    '<span class="limoniapps-discount-url-productprice">' +                                     
        '{{itemPrice}}' +
    '</span>' +
'</div>' +

// For boost-pfs-filter-html.liquid
<div class="product-item--price" data-limoniapps-discounturl-product-handle="[[itemHandle]]" data-limoniapps-discounturl-product-price="[[itemPriceMin]]" data-limoniapps-discounturl-product-compareatprice="[[itemCompareAtPriceMax]]">
     <span class="limoniapps-discount-url-productprice">                                   
        [[itemPrice]]
     </span>
</div>
3
Go to the boost-pfs-filter.js file, then find productGridItemHtml function and paste the snippet to where you want the updated price to appear, for example, under the product title:
Discount Ninja Integrate

If productGridItemHtml variable does not exist, please check the file boost-pfs-filter-html.liquid

Discount Ninja code

Continue to copy the below script to build attributes of the app:

var comparePrice = data.compare_at_price_max || 0;
itemHtml = itemHtml.replace(/{{itemCompareAtPriceMax}}/g, comparePrice);
itemHtml = itemHtml.replace(/{{itemHandle}}/g, data.handle);
itemHtml = itemHtml.replace(/{{itemPriceMin}}/g, data.price_min);
4
Then find the ProductGridItem.prototype.compileTemplate function and paste the script before " Add main attribute" comment:
Discount Ninja and filter
5
Add the following script to the Filter.prototype.afterRender function:
if (typeof discountNinja != 'undefined' ) {
	discountNinja.DynamicPricing.UpdatePrice();
}