Reference

Item

An item is one entry in a list, linking the list to an element such as an entry or a Commerce product. Whenever you’re working with an item in your templates, you’re working with an Item object. You get them from a list’s items, list.getItem() or an item query.

{% for item in list.items %}
    {% set element = item.element %}

    {% if element %}
        <a href="{{ element.url }}">{{ element.title }}</a>
        <a href="{{ item.getRemoveUrl() }}">Remove</a>
    {% endif %}
{% endfor %}

The linked element can have been deleted since the item was added, so check item.element before using it.

Properties

id

The ID of the item.

elementId

The ID of the element the item links to.

elementSiteId

The ID of the site the linked element was added from.

elementClass

The class of the linked element, such as craft\elements\Entry.

elementDisplay

The display name of the linked element’s type, such as Entry for craft\elements\Entry. Twig reads it through getElementDisplay().

element

The element the item links to, or null when it no longer exists. Twig reads it through getElement().

elementTitle

The title of the linked element, or null when it no longer exists. The item’s title holds the same value.

listId

The ID of the list the item belongs to.

list

The list the item belongs to. Twig reads it through getList().

options

The extra options stored with the item, such as a product’s size or colour.

optionsSignature

An MD5 hash of the item’s options, used to tell apart items for the same element with different options. It’s read-only.

Methods

getAddUrl()

Returns the URL that adds the item’s element to a list, or null when the linked element no longer exists.

getRemoveUrl()

Returns the URL that removes this item from its list, or null when the linked element no longer exists.

getToggleUrl()

Returns the URL that adds the item’s element to a list, or removes it when it’s already there, or null when the linked element no longer exists.

getInList()

Returns whether a list contains an item for the same element, site and options as this item.

Last updated: Nov 13, 2026, 3:15:52 PM