Conditionally Hide the Multiple Shipping Address Toggle Based on Your Carts Contents

In order to hide the multi-address toggle conditionally on your site based on the contents of your cart, you can detect the contents, and conditionally load some CSS on your store if certain conditions are met.

The below example shows how to hide the toggle if a “Recharge” subscription item is in the cart.

{% assign show_multi_address = 'true' %}

{% for item in cart.items %}

{% comment %}
Here is where we check for the conditions of the products in your cart. The below checks for the presence of a "subscription_id" line item property. If this is present, we do not want to show Giftship.
{% endcomment %}

{% if item.properties.subscription_id %}

{% assign show_multi_address = 'false' %}

{% endif %}

{% endfor %}

{% if show_multi_address == "false" %}

<style>
/* This hides Giftship's multi-address toggle feature */
#gs__toggle-box {
display: none !important;
}
</style>
{% endif %}

Can't find the answer in our documentation?
Contact Support