Hello,
I currently have a custom liquid block on our product page that displays when the item will be despatched.
{% capture c_date %}{{'now' | date:'%a' }}{% endcapture %}
{% if c_date == 'Sat' %}
**ORDER TODAY FOR DESPATCH ON MONDAY**
{% elsif c_date == 'Sun' %}
**ORDER TODAY FOR DESPATCH ON MONDAY**
{% else %}
**ORDER BEFORE 3PM FOR SAME DAY DESPATCH**
{% endif %}
I would like to display a different message in the same block for a specific variant colour. In this case we will have a green variant and I would like the block to display “AVAILABLE FOR PRE-ORDER”
Does anyone know how I would implement this change? I believe it would be something along the lines of this but I can’t get it to work.
{% assign current_variant = product.selected_or_first_available_variant %}
{%- if current_variant.color contains "green" -%}
<div>
<p><strong>AVAILABLE FOR PRE-ORDER</strong></p>
</div>
{%- else -%}
{% capture c_date %}{{'now' | date:'%a' }}{% endcapture %}
{% if c_date == 'Sat' %}
<div>
<p><strong>ORDER TODAY FOR DESPATCH ON MONDAY</strong></p>
</div>
{% elsif c_date == 'Sun' %}
<div>
<p><strong>ORDER TODAY FOR DESPATCH ON MONDAY</strong></p>
</div>
{% else %}
<div>
<p><strong>ORDER BEFORE 3PM FOR SAME DAY DESPATCH</strong></p>
</div>
{% endif %}
{% endif %}
Any help would be greatly appreciated. Sorry I am quite new to this coding malarkey!