Beneath is the Jquery code written to seize the up to date product worth because the change in worth happens when on chooses a variant of a product. I discover this isn’t even being referred to as when this variation occasion occurs. Please present me what isn’t proper in it? Thanks.
jQuery(".price-box").on("change", ".normal-price .price-wrapper span.worth", operate() {
alert('Simply an alert');
console.log('Whats up, I'm completely happy to be referred to as');
// Get the worth of the span factor
var worth = $(".price-box .normal-price .price-wrapper span.worth").html();
// Clear and Convert the worth to cents
var priceCents = parseInt(parseFloat(worth.exchange(/[^d.]/g,'')) * 100);
// If worth is totally different from present Klarna product placement worth, replace it.
// after which name Klarna with refresh-event to refresh the location.
var oldPurchaseAmt = $(".product-add-form klarna-placement").attr("data-purchase-amount");
if (priceCents != oldPurchaseAmt) {
$(".product-add-form klarna-placement").attr("data-purchase-amount", priceCents);
// Set off occasion to refresh
window.KlarnaOnsiteService = window.KlarnaOnsiteService || [];
window.KlarnaOnsiteService.push({ eventName: 'refresh-placements' });
}
});