# Array\[0\] is null ? if page.cart.lineItems.elements|first.type == "customized-products"

**URL:** https://forum.shopware.com/t/array-0-is-null-if-page-cart-lineitems-elements-first-type-customized-products/94598
**Category:** Shopware 6 (German)
**Created:** [30. Mai 2022 um 06:10 UTC](https://forum.shopware.com/t/array-0-is-null-if-page-cart-lineitems-elements-first-type-customized-products/94598 "2022-05-30T06:10:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dm68](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@dm68](https://forum.shopware.com/u/dm68)
#### Post date: [30. Mai 2022 um 06:10 UTC](https://forum.shopware.com/t/array-0-is-null-if-page-cart-lineitems-elements-first-type-customized-products/94598/1 "2022-05-30T06:10:56Z")

</div>

Hallo zusammen,

das Array page.cart.lineItems.elements hat verschiedene UID’s je Artikel.  
Wenn ich auf die einzelnen Artikel ID’s gehe gehts es ohne Probleme.  
Das Array mit |first läuft auch alles andere bekomme ich nicht raus.  
z.B. page.cart.lineItems.elements[0].type → null  
page.cart.lineItems.elements[1].type → null

Im Prinzip will ich alle Artikel auf customized-products prüfen um einen Hinweis auszugeben:

if page.cart.lineItems.elements|first.type == „customized-products“

Kann mir einer helfen? Danke 🙂

---

<div class="post-metadata">

### Author: ![dm68](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@dm68](https://forum.shopware.com/u/dm68)
#### Post date: [9. Juni 2022 um 19:57 UTC](https://forum.shopware.com/t/array-0-is-null-if-page-cart-lineitems-elements-first-type-customized-products/94598/2 "2022-06-09T19:57:17Z")

</div>

/push it TOP push it TOP

---

<div class="post-metadata">

### Author: ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)
#### Post date: [9. Juni 2022 um 20:47 UTC](https://forum.shopware.com/t/array-0-is-null-if-page-cart-lineitems-elements-first-type-customized-products/94598/3 "2022-06-09T20:47:40Z")

</div>

das könntest du folgendermaßen umsetzen:

```auto
{% for lineItem in page.cart.lineItems %}

    {% if lineItem.type == 'customized-products' %}
         ...
    {% endif %}

{% endif %}

```

Ansonsten, wenn du auf den Index zugreifen willst, würde ich klammern setzen:

```auto
(page.cart.lineItems.elements|first).type

(page.cart.lineItems.elements[0]).type

```
