The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Accessing item options by name?

$benji++$benji++ Member
in Help edited June 2013
When it comes to item options and twig templates, I see stuff like:
{% for option in item.options -%}
    {% if option.name == 'Type' -%}
        "{{ option.value }}",        // Category
    {% endif -%}
{% endfor -%}
(borrowed from http://forum.foxycart.com/discussion/comment/44604#Comment_44604)

Is there any easier way to access item options without the for and if? I suppose that item.options is not an associative array, so one could not do something like item.options.type in the example above. But just thought I'd ask if there are any tricks out there, since this way seems a little expensive.
Comments
  • fc_adamfc_adam FoxyCart Team
    edited June 2013
    @$benji++

    If you're needing to find a specific option - you need to loop through each one to find the name of the option you're looking for and grab it.
Sign In or Register to comment.