Posted on

Magento 2 : Add template below addtocart button and replace quantity and addtocart template from product detail page

I have two requirements

Add template below addtocart button.
Replace the core template of quantity and addtocart button with my own template. How to achieve this

My layout file is below:-

catalog_product_view.xml

<referenceContainer name=”product.info.main”>
<block class=”VendorModulenameBlockProductViewStock”
name=”product.view.stock”
template=”Vendor_Modulename::product/view/stock.phtml”
after=”product.info.addtocart” ifconfig=”form_stock/form_group_general/status”>
</block>
</referenceContainer>

By using this template. I am getting my template on the product detail page below the product name. but my requirement has different which is what I have shown above. If anybody knows then please guide me.

Leave a Reply

Your email address will not be published. Required fields are marked *