I'm having difficulty figuring out how to add a description to a Simple Product that will subsequently be displayed on the Simple Product Details Page. Everywhere I have looked discusses using code to handle this but like i said in my last post im new to magento and cannot figure out how to solve this issue with code solutions provided as they seem to gear towards more advanced developers.

  • Have you added description on product in admin panel? – Shoaib Munir Feb 4 '19 at 4:35
  • @ShoaibMunir No that's what im looking for – jkushner Feb 4 '19 at 15:59

To add product description in simple product only, you can follow below steps.

1) Create a catalog_product_view_type_simple.xml file in app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_product_view_type_simple.xml and paste below code in this file.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="product.info.main">
            <block class="Magento\Catalog\Block\Product\View" name="product.description.simple" template="Magento_Catalog::product/view/type/simple/description.phtml" after="product.info.price"/>

2) Create a description.phtml file in app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/view/type/simple/description.phtml and paste below code.

$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct();
$_attributeLabel = $_product->getResource()->getAttribute('description')->getStoreLabel();
$_attributeValue = ($_helper->productAttribute($_product, $_product->getDescription(), 'description')) ? $_product->getAttributeText('description') : '';
<?php if ($_attributeValue): ?>
    <div class="product-description">
        <strong class="type"><?= /* @escapeNotVerified */ $_attributeLabel ?></strong>
        <div class="value"><?= /* @escapeNotVerified */ $_attributeValue ?></div>
<?php endif; ?>

3) Flush magento cache and check simple product in which you have added description in backend.

  • Where do i add the product descriptions? – jkushner Feb 4 '19 at 17:22
  • You can add product description here: Admin > Catalog > Products > Add New or Edit Product > Content > Description. In default magento, it is not required to code separately to show description. By default it will be display if you have added in backend. – Satish Dubariya Feb 5 '19 at 4:15
  • Welcome and enjoy :) – Satish Dubariya Feb 6 '19 at 4:30

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.