Learn how to integrate Treedify with Store Pickup + Delivery
Add the following code below the <div id="storePickupApp"></div>
line of your shopping cart template.
<input type="hidden" id="checkoutAddress1" name="checkout[shipping_address][address1]" value="" />
<input type="hidden" id="checkoutAddress2" name="checkout[shipping_address][address2]" value="" />
<input type="hidden" id="checkoutCity" name="checkout[shipping_address][city]" value="" />
<input type="hidden" id="checkoutZip" name="checkout[shipping_address][zip]" value="" />
<input type="hidden" id="checkoutCountry" name="checkout[shipping_address][country]" value="" /><input type="hidden" id="locale" name="locale" value="" />
Enter the following in your storepickup-addons.liquid
file:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function() {
window.ZapietEvent.listen('activateCheckout', function(params) {
if (params.method == 'pickup') {
$("#checkoutAddress1").val(params.location.address_line_1);
$("#checkoutAddress2").val(params.location.address_line_2);
$("#checkoutCity").val(params.location.city);
$("#checkoutZip").val(params.location.postal_code);
$("#checkoutCountry").val(params.location.country);
$("#locale").val('en-CA');
} else {
$("#locale").val('en');
$("#checkoutAddress1").val('');
$("#checkoutAddress2").val('');
$("#checkoutCity").val('');
$("#checkoutZip").val('');
}
});
});
</script>