How to make custom metafield data show on product page

How to make custom metafield data show on product page

orbit1996
Visitor
1 0 0

Hi,

 

I have a custom Metafield called: productinfo.ship_date which I use to put the ship date for new incoming products.

 

I currently have a stock info section on the product page to show a products status like this:

{% if current_variant.inventory_management %}
                
                	{% if current_variant.inventory_quantity > 1 %}
                 Availability: <span style="color: limegreen;">In Stock</span>
                
                
              		{% elsif current_variant.inventory_quantity <= 1 and current_variant.inventory_quantity > 0 %}
                Availability: <span style="color: #ff9900;">Low Stock</span>
                
                {% elsif current_variant.inventory_quantity < 1 and current_variant.incoming and current_variant.inventory_policy  == 'continue'%}
                Availability: <span style="color: #EB008D;">Ships on: {{ current_variant.next_incoming_date | date: "%d/%m/%y" }} </span>
                
                	{% elsif current_variant.inventory_quantity < 1 and current_variant.inventory_policy  == 'continue' %}
                Availability: <span style="color: #EB008D;">Pre order</span>
                
                  	{% elsif current_variant.inventory_quantity < 1 and current_variant.incoming %}
                Availability: <span style="color: #EB008D;">Due In - {{ current_variant.next_incoming_date | date: "%d/%m/%y" }} </span>
                	
                	{% elsif current_variant.inventory_quantity < 1 %}
                Availability: <span style="color: red;">Out of Stock</span>
                    {% endif %}
                
                {% endif %}

 

What I want to do, is make something similar to "Due In" but I want it to be for In Stock products, which have a "Ship Date" present, and it for to display that ship date. For products which dont have a "Ship Date" entered in that metafield, it will just say "in stock" like it does now.

 

Ideally I would like it to only show for items which ship date is in the future, and for those in the past just show revert to "in stock", but its not necessary.

 

I'm not sure how to code this as i'm not fully familiarized with liquid.

 

If someone could tell me how to do something like that, it would be greatly appreciated.

Replies 0 (0)