1

I want to convert this "Notify me when this product is in stock" anchor tag into button and it should be open in new tab on click.

Steps to reproduce issue:

Step 1: Enable To Display Out of Stock Products In Frontend

  • In admin panel, go to Stores → Configuration → Catalog → Inventory.
  • Go to the Stock Options → Display Out of Stock Products → “Yes”
  • Click on “Save Config” button

Step 2: Enable “Notify me when this product is in stock” When Product is Back in Stock

  • Go to the Stores → Configuration → Catalog → Product Alerts.

  • Product alerts → Allow Alert When Product Comes Back in Stock → “Yes”.

  • Click on “Save Config” button

    enter image description here

Now I want to change "Notify me when this product is in stock" anchor tag into button and it should be open in new tab on click.

I found below code into "vendor/magento/module-product-alert/view/frontend/layout/catalog_product_view.xml" But, I am not getting how to do it. Kindly assist me to do it, Thanks in advance

<block class="Magento\ProductAlert\Block\Product\View\Stock" name="productalert.stock" as="productalert_stock" template="Magento_ProductAlert::product/view.phtml">
            <action method="setHtmlClass">
                <argument name="value" xsi:type="string">stock</argument>
            </action>
            <action method="setSignupLabel">
                <argument translate="true" name="value" xsi:type="string">Notify me when this product is in stock</argument>
            </action>
</block>

1 Answer 1

1

Looks like you will have to override the following template in your theme and change the anchor tag to a button tag via HTML

  • vendor/magento/module-product-alert/view/frontend/templates/product/view.phtml

Some info on overriding templates in themes:

1

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.