Location filters
Clemency Farmer avatar
Written by Clemency Farmer
Updated over a week ago

If needed, you can override the settings within the app and show only certain locations in the widget by adding a code snippet. You can specifically state the pickup or delivery location(s) that should be displayed, by adding location ID(s).

You can then combine the code with any additional conditions as we note in our examples.

If you're not comfortable with editing code, please contact us at [email protected] and we'd be happy to help!


Set pickup location

  1. To find the location ID, open Zapiet - Pickup + Delivery > Locations and select the location you want to be chosen for pickup. Make a note of the Zapiet location ID.

  2. To find your checkout button, go to your theme files and find your cart file (e.g. cart-template or main-cart-footer).
    Within the cart file, search for:

    name="checkout"


    This should be a part of your checkout button that looks similar to this:

  3. Prepend the code below to the checkout button in your theme files, and replace the value "10001" with your location ID.

    If you want to add multiple locations, separate them with a comma ("10001,10002").

    <input type="hidden" id="pickupFilterByField" value="id" />
    <input type="hidden" id="pickupFilterByValue" value="10001" />

Example

This code will show the locations with the IDs "189486", "214029", and "209381" if there is an item in the cart with the tag "Skis".

  • This will ignore all inventory and product settings.

{% for item in cart.items %}
{% if item.product.tags contains 'Skis' %}
<input type="hidden" id="pickupFilterByField" value="id" />
<input type="hidden" id="pickupFilterByValue" value="189486,214029,209381" />
{% endif %}
{% endfor %}

Now, if there is one item in your cart tagged with "Skis", only locations with these IDs will show: "189486", "214029", or "209381".


Set delivery location

  1. To find the location ID, open Zapiet - Pickup + Delivery > Locations and select the location you want to be chosen for delivery. Make a note of the Zapiet location ID.

  2. To find your checkout button, go to your theme files and find your cart file. Within the cart file, search for:

    name="checkout"


    This should be a part of your checkout button that looks similar to this:

  3. Prepend the code below to the checkout button in your theme files, and replace the value "10001" with your location ID.

    If you want to add multiple locations, separate them with a comma ("10001,10002").

    <input type="hidden" id="deliveryFilterByField" value="id" /> 
    <input type="hidden" id="deliveryFilterByValue" value="10001" />

Example

This code will select the location with the ID "234075" if there is an item in the cart with the tag "Skis".

  • This will ignore all inventory, product and delivery validation settings.

  • We do not recommend adding more than one ID here—it always selects the location with the lowest ID.

{% for item in cart.items %}
{% if item.product.tags contains 'Skis' %}
<input type="hidden" id="deliveryFilterByField" value="id" />
<input type="hidden" id="deliveryFilterByValue" value="234075" />
{% endif %}
{% endfor %}


Now, if there is one item in your cart tagged with "Skis", only location "234075" will show.


Limitations

  • Setting a specific location will ignore any inventory or product settings.

  • Setting a specific location for delivery will ignore delivery validation rules.

  • If you add multiple location ID's for delivery, the widget will always select the location with the lowest location ID.

Did this answer your question?