Please help.
Can'd display metafields informatino in the theme liquid pages.
What I'm doing:
Output:
blank, nothing
Expected Output:
"Black"
Example Metafield data:
["metafield"]=>
array(14) {
[0]=>
array(4) {
["key"]=>
string(4) "colour"
["value"]=>
string(6) "Black"
["value_type"]=>
string(6) "string"
["namespace"]=>
string(6) "global"
}
[1]=>
array(4) {
["key"]=>
string(5) "model"
["value"]=>
string(11) "Summer 2016"
["value_type"]=>
string(6) "string"
["namespace"]=>
string(6) "global"
}
Any ideas?
Thanks - Chris
Hey Sam - I feel like we only have part of the story here. Are you saying that you have created a metafield on a product but it's blank when you try and grab it in Liquid?
Hey Jason,
Liquid; {{ product.global.fabric }}
I doubt the data is publishing properly, the data may not be there. However, the resopnse received from the API is all good. I've tried around 50 variations, using key words: product / variants / global / metafields / metafield
One thing worked, but only for a few minutes. :-/
JSON output metafields
{{ product.metafield | json }} = null
{{ product.metafields | json }} = {"error":"json not allowed for this object"}
URL - Can't see this url helping
https://the-up-styler.myshopify.com/products/chanel-cleopatra-summer-2016
Pass: "upstyler"
PHP is posting data to Shopify
I was posting the "metafields" data via Product > Variant > "metafield"
https://help.shopify.com/api/reference/product
metafield: Attaches additional information to a shop's resources.
I'm posting a few metafields, example:
["metafield"]=>
array(14) {
[0]=>
array(4) {
["key"]=>
string(4) "make"
["value"]=>
string(6) "Chanel"
["value_type"]=>
string(6) "string"
["namespace"]=>
string(6) "global"
}
[1]=>
array(4) {
["key"]=>
string(5) "model"
["value"]=>
string(11) "Summer 2016"
["value_type"]=>
string(6) "string"
["namespace"]=>
string(6) "global"
}
Response from API is perfect. I don't know why I can't access that metafield data. So frustrating.
Metafields is more trouble than what it is worth.
I'm going to solve the issue another way for now.
I wish there was a way to send all data to the "description" field as JSON, and parse the JSON within the Liquid template. Some people say it's possible, however all my tests failed.