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

房东的猫 提交于 2019-12-10 17:56:36

问题


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?


回答1:


{% 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




回答2:


{{ product.metafields.inventory.warehouse }}

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



来源:https://stackoverflow.com/questions/16230835/how-to-display-a-meta-field-on-product-detail-page-in-shopify

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!