cancel
Showing results for 
Search instead for 
Did you mean: 

Could you please ?

Highlighted

Could you please ?

Hi,

 

Here is what I am looking for:

 

Add a button/link below ADD TO CART button, it should open a new page where I want to run some custom logic.

 

I am new to Magento so still struggling with terminology. Could you please guide me here about how can I add a new page and link it to a button/hyperlink?

 

 

(Admin: Not sure which forum this should go in, so posting the same question in two forums)

1 REPLY 1
Highlighted

Re: Could you please ?

Hi There,

 

You need to create catalog_product_view.xml file in your custom module or theme wherever you want. File should be at app/code/Vendor/Module/view/frontend/layout.

 

<?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">
    <body>
      <referenceContainer name="product.info.form.content">
          <block class="Magento\Framework\View\Element\Template" name="custom_button" template="Vendor_module::product/view/custom-button.phtml" after="product.info.addtocart"/>
      </referenceContainer>
    </body>
</page>

Now create custom-button.phtml at app/code/Vendor/Module/view/frontend/templates/product/view and add your code for button.it will show the button below add to cart button. Let me know if I can help you further.