Now there is a custom product attribute named "lead_time" appeared as "Delivery Time" in More Information tab under product image, and I want to move it below add-to-cart button.

"lead_time" attribute appear as "delivery time"

I tried it by putting following codes in catalog_product_view.xml and in leadtime.phtml.

in catalog_product_view.xml

<referenceBlock name="product.info.addtocart.additional">
<block class="Magento\Catalog\Block\Product\View" name="leadtime" template="Magento_Catalog::product/view/leadtime.phtml"/>

in leadtime.phtml

<?php $_product = $block->getProduct(); ?>
<?php echo $_product->getLeadTime(); ?>

The result is showing up a strange number there instead of the attribute's value.

enter image description here

Any help would be appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.