3

I am trying to change sign in or create an account message which is called by block named product.review.form in catalog_product_view.xml.

/vendor/magento/module-review/view/frontend/layout/catalog_product_view.xml

enter image description here

The template used is form.phtml which is set in Magento\Review\Block\Form.php

enter image description here

I want to override this part of code in

/vendor/magento/module-review/view/frontend/templates/form.phtml

<?php else : ?>
    <div class="message info notlogged" id="review-form">
        <div>
            <?= $block->escapeHtml(__('Only registered users can write reviews. Please <a href="%2">Sign in</a> or <a href="%1">create an account</a>', $block->getLoginLink(), $block->getRegisterUrl()), ['a']) ?>
        </div>
    </div>
<?php endif ?>

Question : How can i override the sentence in that particular <div>?

Note : I tried to use plug-in but _construct() is protected and using preference is not suitable for my requirement.

1

It can be override by adding the content / message in the en_US.csv file in the your custom theme.

For reference check the row 120 in sitename/vendor/magento/module-review/i18n/en_US.csv.

| improve this answer | |

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.