Syed Ali
Syed Ali

Reputation: 208

how to display a meta field on product detail page in shopify?

i have a created meta filed using the shopify API call like this:

'POST', '/admin/products/1328/metafields.json', array("metafield" =>           
   array('namespace'=>'inventory',                                                                                              
         'key'=>'warehouse',
         'value'=>"some text here",
         'value_type'=>'string')));

But now I want to show this on product detail page how can I achieve this? Or where it will be displayed on the product detail page in Shopify.

Can anyone (who has a eCommerce shop on any other system but not on shopify) can see these meta fields?

Upvotes: 3

Views: 5163

Answers (2)

Muhammad Ali
Muhammad Ali

Reputation: 2648

{{ product.metafields.inventory.warehouse }}

use this line in product.liquid page. Let me know if it doesn't work.

Upvotes: 2

Farid Movsumov
Farid Movsumov

Reputation: 12735

{% for variant in product.variants %}
  // to display the variant metafields use {{resource.metafields.namespace.key}}
  {{ variant.metafields.ShippingWeight.shipping_weight }}
{% endfor %}

SOURCE : How to Display a Metafield in Shopify

Upvotes: 4

Related Questions