0

To find the solution of this question :
(add to cart not working) Add to cart not working for configurable products on product listing page. Magento - 2
I switched the theme from my custom one to Magento luma to check whether it was a theme problem or not.
After switching back again to my custom theme some js and CSS files could not be loaded
enter image description here

enter image description here


Here is the screenshot of console:
enter image description here

I had used static content deploy, upgrade, flush cache etc commands after changing the theme.

sudo php bin/magento setup:upgrade; sudo php bin/magento cache:flush; sudo chmod -R a+wX pub; sudo chmod -R a+wX var; sudo chmod -R a+wX app; sudo chmod -R a+wX app/etc; sudo chmod -R a+wX generated; sudo php bin/magento setup:di:compile; sudo php bin/magento setup:static-content:deploy; sudo php bin/magento indexer:reindex; sudo php bin/magento cache:flush; sudo chmod -R a+wX pub; sudo chmod -R a+wX var; sudo chmod -R a+wX app; sudo chmod -R a+wX app/etc; sudo chmod -R a+wX generated; 

Also please tell me the proper way of switching between themes in Magento.

  • Is your files (js&css) accessible directly from the browser? It can be permission issue when magento trying to write files in the directory in which it have not permission to write files. Make sure you run all cli commands from the right user (from which web-server runs). – Siarhey Uchukhlebau Mar 16 '18 at 7:41
  • This is Already done – a.no.one Mar 16 '18 at 8:34

Your Answer

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

Browse other questions tagged or ask your own question.