问题
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