Created
April 20, 2016 10:56
-
-
Save veganista/8aa555a1a9f313642db076b823ce7cb1 to your computer and use it in GitHub Desktop.
Debugging Objects in Shopify Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script>console.log({{ product | json }});</script> |
Thanks a lot!
What are you doing when you have larger objects and JSON isn't allowed?
Shopify/liquid#1153
json not allowed for this object
I accessed the properties of the object until it allowed me to do it in my last project.
For example...
<script>console.log({{ product.images | json }});</script>
When I first posted this product
supported JSON, but I guess now it doesn't.
This snippet was a quick way of me examining the object without looking at the docs, maybe not quite as useful now.
Thanks
Good job
thanks so much! 🙇 🙌
really thanx!!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thx! It works. But not everywhere. E.g. in product-template.liquid I was able to get the log when inserting it above the div with the product description: