Skip to content

Instantly share code, notes, and snippets.

@boldsupport
Created April 28, 2020 20:21
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/44890f64ae47ae96a4ad0dae8e8cbd04 to your computer and use it in GitHub Desktop.
Save boldsupport/44890f64ae47ae96a4ad0dae8e8cbd04 to your computer and use it in GitHub Desktop.
<script>
window.onload = function () {
var checkDomElem = function(num){
var sel = document.getElementsByClassName("bold_clone");
if(num < 100 && sel.length == 0) {
setTimeout(function(){
checkDomElem(num + 1);
}, 500)
} else if(sel.length > 0) {
if(BOLD && BOLD.upsell && BOLD.upsell.app && BOLD.upsell.app.ee){
BOLD.upsell.app.ee.on("modal_opened", function() {
var comparePrice = document.querySelectorAll('.bold-product__price--deleted');
comparePrice.forEach(function(compare){
var comparePriceText = compare.innerText,
stripComparePrice = comparePriceText.replace("$", ""),
roundComparePrice = parseFloat(stripComparePrice).toFixed(2),
currentPrice = document.querySelector('.bold-product__price.current_price'),
currentPriceText = currentPrice.innerText,
stripCurrentPrice = currentPriceText.replace("$", ""),
roundCurrentPrice = parseFloat(stripCurrentPrice).toFixed(2);
if (roundComparePrice <= roundCurrentPrice){
compare.remove();
}
});
});
}
} else{
}}
checkDomElem(0);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment