0

I have created the module, now I want to override the vendor\magento\module-catalog\view\base\web\js\price-utils.js file in my custom module to change in one function.

I tried with below code:

  • created requrejs-config.js file in the module as below:
var config = {
 map: {
 '*': {
 'Magento_Catalog/js/price-utils': 'Name_Module/js/price-utils-override'
 }
 }
};

then copy the file into my module Name\Module\view\frontend\web\js\view\price-utils-override.js.

after content deploy command. it is giving error as below "http://127.0.0.1/test/pub/static/version1545992807/frontend/theme/name/en_GB/Name_Module/js/price-utils.js net::ERR_ABORTED 404 (Not Found)".

What is wrong here, please let me know if anyone has any idea about it.

Thanks.

Balwant Singh
1,2902 gold badges12 silver badges29 bronze badges
asked Dec 28, 2018 at 11:35

1 Answer 1

1

Try below solution

requrejs-config.js

var config = {
 map: {
 '*': {
 'Magento_Catalog/js/price-utils': 'Name_Module/js/view/price-utils-override'
 }
 }
};

then run below CMD

php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento cache:clean
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean
rm -rf var/*
rm -rf generated/*

I think you missed view in requrejs-config.js file.

I hope it help..!!!

answered Dec 28, 2018 at 11:43
3
  • appreciated your answer but I am using the module not the theme. Commented Dec 28, 2018 at 11:52
  • @UtsavGupta try my new answer's code. Commented Dec 28, 2018 at 12:05
  • @UtsavGupta welcome :) . Please upvote my answer also so that will help another devlopers. Commented Dec 28, 2018 at 12:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.