Magento 2: Set custom validation message

If you want to change Magento 2 default validation message with your custom message. Then

Just go-to that input field and add a custom attribute “data-msg-required”

data-msg-(validator name)


On product detail page if I click add to cart button without selecting options than its shows This is a required field. But I want to change it with my custom message like Please select size. For this you can add like below.

Share this article

Leave a comment