QuestionQ41

VerifiedWorking with Databases and EAV

A custom product attribute must be created to control whether a message appears below the product title on the cart page, identifying products that may be delivered late.

The new boolean EAV attribute is_delayed has been created and works correctly in both the admin panel and the product page.

What should be implemented next so that the is_delayed EAV attribute can be used in the cart .phtml page, for example as $block->getProduct()->getIsDelayed()?

Explanation

etc/catalog_attributes.xml declares catalog EAV attributes that must be loaded for a particular collection group. Adding is_delayed to the quote_item group causes the quote-item product collection used by the cart to load the attribute, allowing the product model to return it through getIsDelayed(). Adobe Commerce module documentation identifies etc/catalog_attributes.xml as the mechanism used to provide attributes for the quote_item group.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!