Conditionally Hide Giftship Options Based on Your Carts Contents 📦

In order to hide Giftship Options (multiple shipping address toggle, gift messages, datepicker, etc.) conditionally on your site based on the contents of your cart, you can detect the contents in different manners (properties, tags, collections, etc.), and then conditionally load some CSS on your store if certain conditions are met.

Here is an example that shows how to hide the multiple shipping address toggle if a “Recharge” subscription item is in the cart. The below checks for the presence of a “subscription_id” line item property. If this is present, we do not want to show the multiple shipping address toggle.

{% assign show_multi_address = 'true' %}

{% for item in cart.items %}

{% if item.product.tags contains 'Subscription' %}

{% assign show_multi_address = 'false' %}

{% endif %}

{% endfor %}

{% if show_multi_address == "false" %}

<style>
#gs__toggle-box {
display: none !important;
}  
</style>
{% endif %}

Here is an example that shows how to only show both the multiple shipping address toggle and gift message feature if a product tagged with ‘gift’ is present in the cart.

{% assign show_giftship = 'true' %}

{% for item in cart.items %}
	
  {% if item.product.tags contains 'gift' %}

	{% assign show_giftship = 'true' %}

  {% endif %}

{% endfor %}

{% if show_giftship == "false" %}

<style>
  #gs__toggle-box {
    display: none !important;
  }

  #gsAppContainer {
    display: none !important;
  }

</style>
{% endif %}

Here is an example that shows how to only show the multiple shipping address toggle if a product type is equal to a certain type.

{% assign show_multi_address = 'true' %}

{% for item in cart.items %}

{% unless item.product.type == "Gourmet Gift Boxes" or item.product.type == "Other Hampers" %}

{% assign show_multi_address = 'false' %}

{% endunless %}

{% endfor %}

{% if show_multi_address == "false" %}

<style>
#gs__toggle-box {
display: none !important;
}  
</style>

{% endif %}

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