Liquid, JavaScript, themes, sales channels
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 %}
User | RANK |
---|---|
32 | |
27 | |
20 | |
7 | |
7 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023