Zebra ZT411 Industrial Printer
£1,178.31 £2,862.08 ex. VAT
Finance & Leasing
Finance is available on purchases over £1000 exc. VAT.
jQuery(document).ready(function() {
jQuery('input.input-text.qty').on('change keyup', setfinancebutton);
// Variable products: update when variation is chosen or reset
jQuery(document.body).on('found_variation reset_data', setfinancebutton);
setfinancebutton();
});
function roundTwoDecimals(v) {
if (typeof(v) === 'number') {
return (Math.round(v * Math.pow(10, 2)) / Math.pow(10, 2)).toFixed(2);
}
}
function setDisabledState() {
// Set exactly disabled="disabled" so your existing CSS matches
jQuery('#finance-button').attr('disabled', 'disabled').removeAttr('href');
jQuery('#finance-button span')[0].innerText = 'Pay Monthly';
jQuery('#financeOnPurchasesMsg').show();
}
function setEnabledState(href) {
jQuery('#finance-button').removeAttr('disabled').attr('href', href);
jQuery('#finance-button span')[0].innerText = 'Pay Monthly';
jQuery('#financeOnPurchasesMsg').hide();
}
function getUnitPrice() {
// Prefer variation price when a variation is selected
var $variationPrice = jQuery('.woocommerce-variation-price .amount bdi, .woocommerce-variation-price .woocommerce-Price-amount').first();
if ($variationPrice.length && $variationPrice.text().trim() !== '') {
return $variationPrice.text();
}
// Fallback to your original selector
var $suffixPrice = jQuery('.woocommerce-price-suffix .amount bdi').first();
if ($suffixPrice.length && $suffixPrice.text().trim() !== '') {
return $suffixPrice.text();
}
return '';
}
function setfinancebutton() {
var amountText, amount, quantity, cost, itemName, itemsMsg;
if (jQuery('input.input-text.qty').length < 1) return;
quantity = parseInt(jQuery('input.input-text.qty')[0].value, 10);
if (!isFinite(quantity) || quantity < 1) quantity = 1;
amountText = getUnitPrice();
// If no price yet (common on variable products before selecting options), disable and grey out
if (!amountText) {
setDisabledState();
return;
}
// Clean numeric unit price (removes £ and commas etc)
amount = parseFloat(String(amountText).replace(/[^0-9\.]+/g, ''));
if (!isFinite(amount) || amount 1000) {
// Match cart format: name;qty;unitPrice
itemsMsg = itemName + ';' + quantity + ';' + roundTwoDecimals(amount);
setEnabledState(
'/financing-options/?cost=' + roundTwoDecimals(cost) + '&items=' + encodeURIComponent(itemsMsg)
);
} else {
setDisabledState();
}
}










