Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Kyle Chuang commented on Metafields problem

$
0
0

Hi Norbert,

Thank you very much for the help.  The code works as expected and I now see the metafield apprearing my product.liquid.  Unfortunately, I'm hitting another issues at trying to access the metafield in my index.html in my app's webpage (http://localhost:8000).  I've created the metafield as described above.

 In my views.py, I have the following.

def index(request):    prods = shopify.Product.find(limit=3)    for p in prods:       print p.metafields()[0].namespace       print p.metafields()[0].key       print p.metafields()[0].value    return render_to_response('home/index.html', {        'product': p,    }, context_instance=RequestContext(request))

 

I request the metafield using {{ product.metafields.[namespace].[key] }} in product.liquid and it works fine as expected.  In my console when I run my app, metafield value prints on the console correctly with "print p.metafields()[0].value"

In my index.html for the app, I have following line - 

<p> Metafield: {{ product.metafields.test_namespace.test_key }} </p>

exactly the same as products.liquid but seems to throw an error instead of displaying the value.  Can you possibly shed light on this on as well?

 

Thanks,

Kyle

 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>