Custom metafield code

Hi Guys, i am having an issue using Metafield, If the selected variant has a stock arrival date, should show “New Stock Arriving: October 15, 2025” If the variant doesn’t have a date, it should be empty

here is my code :

{% for variant in product.variants %}
{% if variant.id == 39479736238279 %}
{% if product.handle == "square-downface-ctc" or product.metafields.custom.new_stock_arriving %}
        
          <p><b>New Stock Arriving:</b> 
{{ product.metafields.custom.new_stock_arriving | date: "%B %d, %Y" }}</p>
        
        {% endif %}

        
        {% endif %}
        {% endfor %}

Can you please assist me with this ?

Value : product.metafields.information.directions.value

Use the value field to access the data

product.metafields.custom.new_stock_arriving.value

1 Like

Thank you for the feed back, unfortunately I am still stuck with the same problem

  • Make sure your metafield is defined on the variant, not the product. If variant please use the below format

variant.metafields.custom.new_stock_arriving