Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Fetch custom product options on custom Cart, receipt and email templates

AkashAkash Member
in Help edited January 2014
Hi all

I am using custom templates for Cart, receipt and email templates. While adding products into foxycart, we also store custom properties into the options property of individual properties as specified in[url=""][/url]

I need to fetch those individual custom properties stored in products in twig template to manipulate the output that is to be generated.

Any help is appreciated :-)
  • winstonwinston FoxyCart Team

    Twig templates are only available starting in FoxyCart version 1.0. I see that you linked to a 0.7.2 documentation page. Are you working on a 0.7.2 store or later? If you're at least on 1.0, you can access custom properties in the twig like so:
    {% for item in items %}
      {% if item.options|length > 0 %}
        {% for option in item.options %}
         {# any logic goes in here #}
          {{ }}
          {{ option.value }}
        {% endfor %}
      {% endif %}
    {% endfor %}
  • @winston
    Hey, first of all thanks a lot for sharing the code. Yes it worked in almost a similar way as your sample code.
    And regarding the version, I am using the latest one, I just mentioned the one that I found first.
    I got confused, as in case of JSON, the data is directly stored inside options object, but in twig, its deep inside.

    Thanks :-)
  • winstonwinston FoxyCart Team

    Awesome! Glad to help. Just so you know, there are example twig tutorials here: that should help you find different twig variables!
  • @winston Thanks for the help, that contains a lot of useful code snippets.
Sign In or Register to comment.