Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We have a liquid code block on our product pages that is configured with a simple if/else statement to display a unique message for different inventory scenarios (i.e. In Stock - Ready to Ship, Made to Order, etc.). This block should render a new message if a certain product variant is out of stock. The code block currently works unless a product has some variants that are in stock and other variants that are out of stock.
For products with in and out of stock variants, the liquid block works if the user manually refreshes the page; however, assuming most people will not do that, we need the code block to automatically refresh when someone changes the product variant (i.e. size, color, etc.).
We are using Broadcast theme 3.7.1.
For reference, this is the liquid code snippet installed in our product page template, and these are the messages that should be automatically rendering:
{% if product.tags contains 'Made to Order' %}
<img src="{{ 'icon-blue-circle.svg' | asset_url }}" class="icon icon-box" <p> Made-to-Order - See Shipping Details Below </p>
{% elsif product.tags contains 'personalized' %}
<img src="{{ 'icon-blue-circle.svg' | asset_url }}" class="icon icon-box" <p> Personalized - See Shipping Details Below </p>
{% elsif product.tags contains '_preorder' %}
<img src="{{ 'icon-blue-circle.svg' | asset_url }}" class="icon icon-box" <p> Pre-Order - See Shipping Details Below </p>
{% elsif product.selected_variant.inventory_quantity <= 0 %}
<img src="{{ 'icon-blue-circle.svg' | asset_url }}" class="icon icon-box" <p> Made-to-Order: See Shipping Details Below </p>
{% else %}
<img src="{{ 'icon-taupe-circle.svg' | asset_url }}" class="icon icon-box" <p> In-Stock - Ready to Ship or Pickup in Showroom! </p>
{% endif %}
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025