π Here is the guide for Discount Ninja Integration with Boost AI Search & Discovery app.
How to integrate Discount Ninja with Boost AI Search & Discovery
β οΈ This feature only works with Boost AI Search & Discovery V2.
From your Shopify admin, go to Online Store > Themes.
Find the theme you'd like to integrate the app and click Actions (β―) > Edit code
In Asset folder, search for this file boost-pfs-filter.js. Then locate this line of code
productGridItemHtml
4. Copy and paste this code snippet into the function where you'd like it to be:
{% comment %} For boost-pfs-filter-html.liquid {% endcomment %}
<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 example, under the product title:
If the variable <strong>productGridItemHtml</strong>
does not exist in <strong>boost-pfs-filter.js</strong>
, please find it in the file <strong>boost-pfs-filter-html.liquid</strong>
and paste this code snippet instead:
5. In boost-pfs-filter.js file, locate this line of code:
ProductGridItem.prototype.compileTemplate
6. Within the function ProductGridItem.prototype.compileTemplate, scroll down to locate this comment line:
// Add main attribute
7. Copy and paste this code snippet above the comment line:
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);
8. Continue to locate this line of code:
Filter.prototype.afterRender
9. Copy and paste this code snippet into the function Filter.prototype.afterRender
if (typeof discountNinja != 'undefined' ) { discountNinja.DynamicPricing.UpdatePrice();}
10. Click Save and you're set!