So, I'm running an online shoe store using BigCommerce for Wordpress, and everything is working good except for one thing: our client doesn't like it when the MSRP price + Regular price display together when the values are the same. So, we wrote a script that compares both prices and disables the MSRP price if both values are equal.
This is actually working perfectly everywhere except the product quick view card. So, I figure the quick view isn't loaded before the script fires. I'm not sure how to fix it.
I've tried loading the script inside the Quick View Product Card template, but that just breaks every product grid all over the site.
The Script:
/IF MSRP & REGULAR PRICE ARE THE SAME, REMOVE MSRP
jQuery(function($) {
//Pull price data
var divs2 = $('.msrp-fix .bc-product__price', this).html();
var divs = $('.msrp-fix .bc-product__retail-price-value', this).html();
//Pull page path
var pathname = window.location.pathname;
//Fire on all pages except sale page
if (pathname != "/sale/") {
//If MSRP + Price are equal
if (divs == divs2) {
//Apply this style
$( ".bc-product__retail-price" ).css( "display", "none" );
// If not, do nothing
} else {
}
}
});
I'm not very experienced with this kind of thing, so I'm unsure of what my options are. Is there a different way to get the script to fire? A way to target the modal and fire on open? Hoping for some advice!