CityPlus System Refills Set Filter # 1 and 2
(function() { document.addEventListener("DOMContentLoaded", function(event) { if (window.location.href.indexOf('/products/') > 0) { injectSimpleLinePropertyScript(); } }); })(); function injectSimpleLinePropertyScript() { const dataJSON = '{"CityPlus System Refills - Filter #1":1,"CityPlus System Refills - Filter # 2":1}'; const data = JSON.parse(dataJSON); let a = document.querySelectorAll("[name=id]"); if (a == undefined || a[0] == undefined) { return; } let count = 1; for (const key in data) { let nNode = document.createElement("input"); nNode.type = "hidden"; nNode.name = "properties[" + count + "]"; nNode.value = key +" x "+ data[key]; console.log('Combowise: ', nNode); a[0].parentNode.insertBefore(nNode, a[0].previousSibling) count ++; } }