1

when i enable "Allow Alert When Product Comes Back in Stock" on magneto admin backend and it shows "Notify me when this product is in stock" on product page. I want to edit the product alert text on front but how? i have no idea, please help!

enter image description here

1

You can turn on your Template Path Hints and see which file it is.

Check this link: https://docs.magento.com/user-guide/system/template-path-hints.html

And when you are editing you should follow Magento's best practice.

Template customization walkthrough

To customize a template:

  1. Locate the template which is associated with the page/block you want to change using template hints.

  2. Copy the template to your theme folder according to the template storing convention.

  3. Make the required changes.

To add a new template in a theme:

  1. Add a template in your theme directory according to the template storing convention.

  2. Assign your template to a block in the corresponding layout file.

Ref: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-walkthrough.html

1
  • I haven't use this before and it looks good. Thanks your information. – 王興全 Feb 25 at 9:10
1

Override vendor/magento/module-product-alert/view/frontend/layout/catalog_product_view.xml to your theme and change the setSignupLabel in productalert.stock block

1
  • Thanks, and it works after clean magento cache. – 王興全 Feb 25 at 9:09
1

Actually there's another easier way which is Inline Translate.

Translating is simply just changing 1 text to another.

You can use Inline Translate or Translate using the i18n folder that Magento provided.

More information can be found here: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/translations/xlate.html

1
  • It's true. I think i should rewrite translate file not to edit code. – 王興全 Mar 2 at 6:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.