Accessing product options from twig

happycloudhappycloud Member
in Help edited April 2014
In my receipt I am populating some analytics data and need to access what is in the fc_json as products[0.options.type - I have tried to do items[0].options.type in twig but it's empty. How can I access this? And is there a list of all twig vars somewhere? I would love access to things like shipping cost, etc that don't require stripping currency symbols and commas. It looks like the fc_json object only contains minimal info unfortunately.
  • fc_adamfc_adam FoxyCart Team

    Unfortunately we don't currently have a page listing all of our twig variables available. It is something we're planning to build out for our upcoming version to make working with Twig even easier.

    Also in our current version, we don't have a currency symbol free version of the prices (also something we're rectifying in 2.0) - so you'll need to do a replace of them within the twig.

    So in terms of how to access the data - there isn't currently a parity between the JSON object and the twig object - so you don't want to reference the JSON when trying to work out the Twig variables. In 2.0 (I've mentioned that a lot so far!) we're implementing complete parity between the two, so that will be easier there.

    For getting product details, take a look at the cart twig template available on our template wiki page here: and you'll see an example of how to loop through the products. Referencing those templates are currently the best way to see what variables are present in the Twig.
  • Thank you, that did the trick!
Sign In or Register to comment.