Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Custom delivery validator widget
<form onsubmit="validateZipCode(); return false;">
<input type="text" id="zipcode" placeholder="Enter zipcode here ..." />
<input type="submit" value="Go" />
<script type="text/javascript">
function validateZipCode(e) {
const zipcode = document.getElementById('zipcode').value;
if (typeof window.Zapiet === 'undefined' || typeof window.ZapietCachedSettings === 'undefined' ||
typeof window.Zapiet.DeliveryValidator === 'undefined' || window.ZapietCachedSettings.cached_config === 'undefined' ||
window.ZapietCachedSettings.cached_config.delivery_validator === 'undefined') {
console.warn('Zapiet - Custom delivery validator error. Please ensure you have Store Pickup + Delivery correctly installed. Contact for assistance.');
return false;
Zapiet.DeliveryValidator.checkEligiblity(zipcode, function(response) {
// Eligible callback
}, function() {
// Not eligible callback
}, function() {
// Error callback
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.