Skip to content

Instantly share code, notes, and snippets.

@boldsupport
Created February 21, 2020 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boldsupport/4895b7abad98b9f85d3c327fe5040eaa to your computer and use it in GitHub Desktop.
Save boldsupport/4895b7abad98b9f85d3c327fe5040eaa to your computer and use it in GitHub Desktop.
var boldglobo = GloboFilter.prototype.buildProductsHTML;
GloboFilter.prototype.buildProductsHTML = function(products) {
for (var i = 0; i < products.length; i++) {
if (products[i].tags && products[i].tags.indexOf("OPTIONS_HIDDEN_PRODUCT") != -1) {
products.splice(i, 1);
i--
continue;
}
BOLD.helpers.getProduct(products[i].handle, function(e) {
document.querySelector('[href*=' + products[this].handle + ']').querySelector('.price-item--regular').innerHTML = BOLD.common.Shopify.formatMoney(e.price_min);
}.bind(i));
}
return boldglobo.bind(this)(products);
}
var BOLD=window.BOLD||{};BOLD.helpers=BOLD.helpers||{},BOLD.helpers.getProductSync=function(e,t,o){var r,n="/products/"+e;(o=o||{}).raw?n+=".js":n+="?view="+(o.view||"json"),(r=new XMLHttpRequest).onreadystatechange=function(){if(4==r.readyState&&200==r.status)try{var n=r.responseText;"string"==typeof n&&(n=JSON.parse(n)),"function"==typeof t?t(n):"object"==typeof Shopify&&"function"==typeof Shopify.onProduct&&Shopify.onProduct(n)}catch(r){if(o.raw)return!1;BOLD.helpers.getProduct(e,t,{raw:!0})}},r.open("GET",n,!1),r.send()},BOLD.helpers.getProduct=function(e,t,o){var r,n="/products/"+e;(o=o||{}).raw?n+=".js":n+="?view="+(o.view||"json"),(r=new XMLHttpRequest).onreadystatechange=function(){if(4==r.readyState&&200==r.status)try{var n=r.responseText;"string"==typeof n&&(n=JSON.parse(n)),"function"==typeof t?t(n):"object"==typeof Shopify&&"function"==typeof Shopify.onProduct&&Shopify.onProduct(n)}catch(r){if(o.raw)return!1;BOLD.helpers.getProduct(e,t,{raw:!0})}},r.open("GET",n,!0),r.send()};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment