document.addEventListener('DOMContentLoaded', function() {
// Initialize date picker
const datepicker = document.getElementById('shipping_datepicker');
if (datepicker) {
flatpickr(datepicker, {
dateFormat: 'Y-m-d',
});
}
// Function to update month dropdown fields based on the selected frequency
window.updateMonthFields = function(frequencyId, monthFieldPrefix) {
const frequency = document.getElementById(frequencyId).value;
const monthCount = frequency === '3 Months' ? 3 : frequency === '6 Months' ? 6 : 0;
// Show or hide month fields based on the frequency
for (let i = 1; i <= 6; i++) {
const monthField = document.getElementById(monthFieldPrefix + i + '_field');
if (monthField) {
monthField.style.display = i <= monthCount ? 'block' : 'none';
}
}
};
// Function to validate form submission
const form = document.querySelector('form[action*="/cart/add"]');
form.addEventListener('submit', function(event) {
const requiredFields = form.querySelectorAll('.required');
let allFieldsValid = true;
requiredFields.forEach(function(field) {
if (!field.value) {
field.classList.add('invalid');
allFieldsValid = false;
} else {
field.classList.remove('invalid');
}
});
if (!allFieldsValid) {
event.preventDefault(); // Prevent form submission if validation fails
alert('Please fill out all required fields.');
}
});
});
In stock and ready for shipping
Product Information
The ultimate gift combo for yourself, or for someone who is about to get very lucky: a quart of pickles plus a pint of olives delivered each month for three or six months. Select your favorite varieties for each monthly package, then sit back, relax, and let the happiness begin!
Choosing a selection results in a full page refresh.