I’m working on a theme for my store. We added in a javascript-based functionality that allows people to calculate a quick estimate for a product, outside of actually ordering this. It works with volume pricing, for which I added custom data metafields of the type ‘money’ on products. I’d like to access the data in these fields from my liquid template. When I address the custom metafield, it returns a JSON-like string, like below. I’d like to specifically address the amount or currency. When looking further, documentation and shopify help told me to address these by adding the .amount or .currency_code key in my liquid. But this does not work. How can I get to the data in this json-object without having to use JS and process it on the frontend?
Hi Monicadanvers33, thanks for the help. I’ve tried this approach, but it also outputs nothing. I’m sure the values are set correctly, and if I output the entire metafield value it shows me the json string, so I know that the data is in there. It just doesn’t return anything when trying to parse the json…
It does show the ‘Amount:’ and ‘Currency:’ so it is just the actual amount and curreny_code that return nothing
Hi Guleria, thanks for the help, but this didn’t work. The json_parse filter doesn’t exist in my liquid (it was showing an underlined error in the editor for it), so this also doesn’t return anything for the ‘amount’ and ‘currency_code’ values.