2

I am completely new to magento. I use Magento 2.3 and I created an attribute Lieferzeit under Stores->Attributes->Product and set visibility to yes.

Further, I set the Attribute to a group in Stores-Attributes-> Attribute Set.

What is the next step here? I am confused.

2 Answers 2

0

If you want to show your attribute above/below stock availability, You need to copy:

magento2Root/vendor/magento/module-catalog/view/frontend/templates/product/view/type/default.phtml

to

app/design/frontend/{Package}/{theme}/Magento_Catalog/templates/product/view/type/default.phtml

In the above file you already have $_product object.

at the end of file, put below code to get your attribute:

<?php echo $_product->getAttributeText('lieferzeit'); ?>
    -------OR------
<?php echo $_product->getLieferzeit(); ?>
    -------OR------
<?php echo $_product->getData('lieferzeit'); ?>

Note:

  • Use any one code from above
  • I am assuming your attribute code is lieferzeit.
1
  • Where do i set Visible on Catalog Pages on Storefront? in Admin section?
    – Ken
    Commented Apr 9, 2019 at 8:44
0

Hello and thank you for your answer. I copied the default.phtml in the folder and added <?php echo $_product->getAttributeText('lieferzeit'); ?> at the very bottom. Flushed Cache but it doesnt appear in frontend. I am using the Porto Theme if this is important.

3
  • Okay, now i used another code and it worked. Thank you so far. But now i got a new tab with this informations shown. pixelmonkeys.de/screenshot.png
    – Ken
    Commented Apr 8, 2019 at 10:01
  • You need to set Visible on Catalog Pages on Storefront->` NO`, if you don't want to show on front tab
    – Pawan
    Commented Apr 9, 2019 at 3:16
  • Your answer should be comment for given answer. if you need any clarification, put a comment to answer!
    – Pawan
    Commented Apr 9, 2019 at 3:17

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.