Please see attached screenshot: [![enter image description here][1]][1]

I created one custom product attributes ETA_DATE and I want to display same as attached image. How to display this attribute on product page?

enter image description here

  • Hello, did you found solution ?
    – Pawan
    Commented Nov 30, 2018 at 16:31
  • No, I updated my question. Do you know how can I do?
    – kiran
    Commented Nov 30, 2018 at 16:35
  • edit: {Magento2Root}/app/design/frontend/{Package}/{theme}/Magento_Catalog/templates/product/list.phtml and call <?php echo getEtaDate(); ?> Or <?php echo getAttributeText(eta_date); ?>
    – Pawan
    Commented Nov 30, 2018 at 16:43
  • Duplcate - magento.stackexchange.com/questions/191613/… Commented Nov 30, 2018 at 16:46

1 Answer 1


Try below code to get custom attribute value.

<?php echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($block->getProduct(), $block->getProduct()->getEtaDate(), 'Eta_Date')); ?>



$attribute = $_product->getResource()->getAttribute('attribute_code');

// Get Value

$attributeValue = $attribute->getFrontend()->getValue($_product);

// Get Label

$attributeLabel = $attribute->getStoreLabel();

Note: Make sure “Visible on Product View Page on Front-end” and “Used in Product Listing” options under storefront Properties are set to Yes.


    $attribute = $_product->getResource()->getAttribute('eta_date'); 
    $etaDate = $attribute->getFrontend()->getValue($_product); 
    $newDate = date("d/m/Y", strtotime($etaDate));
    $etaLabel = $attribute->getStoreLabel(); 
    echo $etaLabel." ".$etaDate;
  • In which file I'll use this code?
    – kiran
    Commented Nov 29, 2018 at 21:49
  • if you want it after "Add to cart" button then app\design\frontend\Vendor\theme\Magento_Catalog\templates\product\view\addtocart.phtml use this file. Commented Nov 29, 2018 at 21:51
  • this code is not working and I find addto cart file:vendor/magento/module-catalog/view/frontend/templates/product/addtocart.phtml I use this code but it doesn't show me custom attributes.
    – kiran
    Commented Nov 29, 2018 at 21:58
  • What exactly your attribute code is? Its all Capital letters? Also, make sure that your file is coming from theme or from vendor? Commented Nov 29, 2018 at 21:59
  • my attribute code is eta_date and I copy addtocart.phtml from vendor to app/design folder but this code is not working.
    – kiran
    Commented Nov 30, 2018 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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