I need to display a few attributes in the cart page. How can i accomplish that? enter image description here

  • You Have to create attribute and assign to that product @Athbi Jul 15, 2017 at 8:17
  • Look at these below link for clarity @Athbi Jul 15, 2017 at 8:19
  • Hi @Athbi Please use the below code and get back with your comments thanks Jul 15, 2017 at 8:49
  • Please accept the answer so that it will useful for the other developers thanks Jul 15, 2017 at 9:05
  • Please comment me I u need assistance thanks Jul 16, 2017 at 5:33

1 Answer 1


Please follow the below steps:

Assuming you have a module already created

Step 1: Create an attribute and assign to product Ex: discount_price (your product attribute). Call the same from your custom module as shown below:


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd">
    <group name="quote_item">
     <attribute name="discount_price"/>

Step 2: Go to below path: app/design/frontend/[themepackage]/[theme]/Magento_Checkout/templates/cart/item/default.phtml

Use like this <?php echo $_item->getProduct()->getData('discount_price');?>

Step 3: Clear cache and page cache and go to frontend & check the same.

  • 1
    Where exactly do I place the catalog_attributes.xml do I need to create a module?
    – gabehou
    Oct 3, 2017 at 18:24
  • In your custom module. If not plz create. Thanks Oct 4, 2017 at 0:33
  • i am able to get value but it in integer that is option how can i get label or text value here ?
    – kushal
    Oct 9, 2019 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.