Hi all and nice to meet you.

Some days ago I've modified vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml in order to add a static phrase to every product page. I know it's not the right way and i should rather override in app/design/ but it worked and it was only for few days. I regenerated di, static and cache:

php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento cache:flush

Everything worked and the phrase was online.

Now I've removed the phrase from vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml. I do the regeneration of everything (di, static and cache) and the phrase is still there. I search for the phrase in the filesystem and it's only inside var/page_cache files. Why regenerating the cache put the phrase in if it's not present in my templates? What I'm doing wrong?

  • Jus delete var/page_cache and regenerate static.
    – BartZalas
    May 22, 2020 at 14:31
  • Nope. The phrase is still present. If I search it with grep -rl "phrase" . it shows only results in ./var/page_cache/ Even after deleting ./var/page_cache/ and regenerating static
    – Cosimo
    May 22, 2020 at 15:50

1 Answer 1


Hi Cosimo welcome to the community,

I'm not sure in which mode your store is. Production mode automatically does the compile. Since you have manually instructed the command setup:static-content:deploy

This creates pub/static, generated/code and other folder you can see here: https://devdocs.magento.com/guides/v2.3/howdoi/php/php_clear-dirs.html

Now that you have made changes to an html file and issued compilation, the files are now loaded from pub/static folder.

So your solution would be to:

rm -rf pub/static, var/view_preprocessed, var/cache, var/page_cache, generated/code

Running compile again those folders will be re-populated from current source data (which doens't contain you core modification static phrase)

If my answer resolves your issue, please mark this as solved.

  • Thank you very much. Hope to be usefull to the community growth. Unfortunately the generated content still show the phrase (and also some 404 on js like https://*****/static/version1590171754/frontend/Venustheme/CustomTheme/it_IT/Ves_Productlist/js/productlist.js ). The store is in production mode
    – Cosimo
    May 22, 2020 at 18:48
  • Maybe i need also to run php bin/magento setup:upgrade before compile and static content ? I'm in production and don't want to break everything :D
    – Cosimo
    May 22, 2020 at 19:00
  • Yes of course, run the -rm -rf command to remove those files. Then setup:upgrade then compile.
    – M. Sonah
    May 22, 2020 at 19:26
  • Also visit the website in Incognito mode, since it won't load the js files from browser cache
    – M. Sonah
    May 22, 2020 at 19:27
  • Since you're in Production mode. You should also clear generated/code folder. Updated solution above
    – M. Sonah
    May 22, 2020 at 19:31

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.