This script will show you how to get data from a specific data in JSON file and place it in the product Grid
This example below takes a field called 'unit_price'
use this site - https://regexr.com/ to understand how to define the REGEX
<script>
var CREATION_DATE_REGEX = /unit_price\"\:\"([0-9,\.])*\"/gi;
var __isp_options = {
isp_serp_callback: function(data, facets_only) {
/* Loop over all products */
for(let key in ISP_PRODUCTS){
let isp_prod = ISP_PRODUCTS[key];
$.getJSON(isp_prod.u + ".json", function (response) {
let creationDate = JSON.stringify(response);
let numOfDays = 15;
var itemprice = creationDate.match(CREATION_DATE_REGEX);
if (itemprice != null){
var realprice = itemprice[0].replace('unit_price":"','');
var finalprice = realprice.replace('"','');
if(($jquery_isp(`li[product_id="${isp_prod.id}"]`).find('.isp-custom-price').length === 0) ){
$jquery_isp(`li[product_id="${isp_prod.id}"]`).find('.isp_product_price_wrapper').before(`<span class="isp-custom-price New">Grundpreis: €${finalprice} </span>`);
}
}
});
}
}
};
</script>