Place Your Order
Fill out the form below and we’ll get back to you to confirm your order and arrange delivery.
document.addEventListener(‘DOMContentLoaded’, function () {
try {
var params = new URLSearchParams(window.location.search);
var encodedOrder = params.get(‘order’);
if (!encodedOrder) {
return;
}
var decodedOrder = decodeURIComponent(encodedOrder.replace(/\+/g, ‘ ‘)).trim();
if (!decodedOrder) {
return;
}
// Show and populate the summary card
var summaryCard = document.querySelector(‘.order-summary-card’);
if (summaryCard) {
summaryCard.style.display = ”;
var summaryText = summaryCard.querySelector(‘.order-summary-text’);
var totalEl = summaryCard.querySelector(‘.order-summary-total’);
if (summaryText) {
var lines = decodedOrder.split(/\r?\n/).map(function (line) {
return line.trim();
}).filter(function (line) {
return line.length > 0;
});
summaryText.textContent = lines.join(‘\n’);
}
if (totalEl) {
var totalLine = null;
if (typeof lines !== ‘undefined’) {
totalLine = lines.find(function (line) {
return /total/i.test(line);
}) || null;
}
if (totalLine) {
totalEl.textContent = totalLine;
} else {
var amountMatches = decodedOrder.match(/\$[0-9,]+(?:\.[0-9]{1,2})?/g);
if (amountMatches && amountMatches.length) {
var total = amountMatches.reduce(function (sum, match) {
var num = parseFloat(match.replace(/[^0-9.]/g, ”));
if (!isNaN(num)) {
return sum + num;
}
return sum;
}, 0);
if (!isNaN(total) && total > 0) {
totalEl.textContent = ‘Total: $’ + total.toFixed(2);
} else {
totalEl.style.display = ‘none’;
}
} else {
totalEl.style.display = ‘none’;
}
}
}
}
// Prefill Jetpack form fields
var form = document.querySelector(‘.cali-order-form’);
if (form) {
var orderTextarea = null;
var specialNotesTextarea = null;
var textareas = form.querySelectorAll(‘textarea’);
textareas.forEach(function (ta) {
var wrapper = ta.closest(‘.grunion-field-wrap, label, div’);
var label = wrapper ? wrapper.querySelector(‘label’) : null;
var labelText = label ? (label.textContent || ”) : ”;
if (!orderTextarea && /order details/i.test(labelText)) {
orderTextarea = ta;
}
if (!specialNotesTextarea && /special notes/i.test(labelText)) {
specialNotesTextarea = ta;
}
});
if (orderTextarea) {
orderTextarea.value = decodedOrder;
}
if (specialNotesTextarea) {
var existing = specialNotesTextarea.value || ”;
var prefix = existing ? existing + ‘\n\n’ : ”;
specialNotesTextarea.value = prefix + ‘Order Summary:\n’ + decodedOrder;
}
var hiddenField = form.querySelector(‘input[name=”order_details”]’);
if (!hiddenField) {
hiddenField = document.createElement(‘input’);
hiddenField.type = ‘hidden’;
hiddenField.name = ‘order_details’;
form.appendChild(hiddenField);
}
hiddenField.value = decodedOrder;
}
} catch (e) {
// Fail silently if anything goes wrong
}
});
Your order will be confirmed in a few minutes.
