Skip to content

Instantly share code, notes, and snippets.

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 riq363/5518850496c937ddd975 to your computer and use it in GitHub Desktop.
Save riq363/5518850496c937ddd975 to your computer and use it in GitHub Desktop.
Replace $0.00 price with 'Call for price' text
<script>
Ecwid.OnPageLoaded.add(function(page){
setTimeout(function hidePrice() {
$(".ecwid-productBrowser-price").each(function(idx, el){
if ($(el).text() == Ecwid.formatCurrency(0)) {
if(page.type == "CATEGORY") {
$(el).text('Call for price');
$('.ecwid-BuyNow-outOfStockLabel').hide();
}
else if (page.type == "PRODUCT") {
$(this).text('Call for price');
$('.ecwid-productBrowser-details-inStockLabel').show();
$('.ecwid-productBrowser-details-outOfStockLabel').hide();
$('.ecwid-AddToBagButton').hide();
}
}
else {
$('.ecwid-productBrowser-details-outOfStockLabel').show();
$('.ecwid-AddToBagButton').show();
}
});
}, 50);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment