How to add the details for cart item in Magento 2

In this blog post, I would like to share a pretty interesting and not obvious solution on how to join some additional details to cart item block on checkout cart page.

Let’s say we need to add the “Brand” custom product attribute and show its value within a specific block on the product view page and checkout cart page. It’s very simple in the scope of the product page, but how to deal with number cart items on checkout cart page. There are a couple of issues which you may face with. We will cover them further.

Catalog Attributes in Magento 2

Quite often Magento developers face a problem with accessing custom attributes during product collection loading. For example, when you try to get a product from a quote or a wishlist item. As the result, we’ve noticed some interesting workarounds to bypass the problem and to access the attribute value at any price, like repetitive product loading etc. However, there is a proper way to make these attributes accessible. We would like to tell more about it.