0

Does anyone know how we can add new custom button beside Addtocart button on product page. The button I can add custom link, any help or suggestions would be greatly appreciated!

I tried How to add a custom button to Magento 2 product page but doesn't help alot

1 Answer 1

0

Simply: in your product page:

<button type="button" class="custom-product-link" onclick="location.href='your-link-here'"><span><?= $block->escapeHtml(__('Custom')) ?></span></button>

If you want to call a module controller:

onclick="location.href='<?= $block->getUrl("frontname/controllerfolder/controllername"); ?>'"
2
  • Can you post the file path here
    – Daniel_12
    Commented Oct 19, 2018 at 8:32
  • Enable the path hints like this : Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront > Yes Then you'll see the path
    – PЯINCƎ
    Commented Oct 19, 2018 at 8:34

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.