Question

I am trying to override a default Magento html template, but no matter what I try, it won't work. Here are the two paths:

Default Magento path:

/project_folder/vendor/magento/module-ui/view/frontend/web/templates/form/element/helper/tooltip.html

Override Paths attemted:

/project_folder/app/design/frontend/Module/Component/Magento_Ui/view/frontend/web/templates/form/element/helper/tooltip.html

/project_folder/app/design/frontend/Module/Component/Magento_Ui/web/templates/form/element/helper/tooltip.html

/project_folder/app/design/frontend/Module/Component/Magento_Ui/templates/form/element/helper/tooltip.html

There are other files in the project that are overriding the default files in this same exact way and they all work. I've tried flushing the cache multiple times, deleting and deploying static content, running setup:upgrade, none of it works. Also, I know it's not redirecting because if I change anything in the default path, those changes show up.

Any help is appreciated.

Was it helpful?

Solution

Just try below one:

/project_folder/app/design/frontend/Module/Component/Magento_Ui/web/template/form/element/helper/tooltip.html

After overriding it please run below command:

rm -rf generated/* pub/static/* var/*

php bin/magento s:up

php bin/magento s:s:d -f

php bin/magento cache:flush

OTHER TIPS

Try following trick.

File: [Vendor]/[Module]/view/frontend/requirejs-config.js

var config = {
    map: {
        '*': {
            'Magento_Ui/templates/form/element/helper/tooltip.html': 
              '[Vendor]_[Module]/templates/form/element/helper/tooltip.html'
        }
    }
}

File: [Vendor]/[Module]/view/frontend/web/templates/form/element/helper/tooltip.html

<!-- Your code here -->

After this open your magento 2 root directory in CLI and execute following commands.

rm -rf var/view_preprocessed/*
rm -rf pub/static/frontend/*
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

This will work.

If you want to override the Magento UI component then you need to follow the steps

Step 1: Create a requirejs-config.js in your module and add the following code:-

var config = {
    map: {
        "*": {
            'ui/template/form/element/helper/tooltip.html':'Vendor_Module/templates/form/element/helper/tooltip.html'
        }
    }
};

Step 2: Copy From

/project_folder/vendor/magento/module-ui/view/frontend/web/templates/form/element/helper/tooltip.html

to

/project_folder/app/design/frontend/Module/Component/Vendor_Module/web/templates/form/element/helper/tooltip.html

Let me know if you still have any issue. Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top