All I'm trying to do is add a method to an existing js file. Specifically place-order.js, I understand that I need to do something to requirejs and I understand the logic behind it but for the life of me I can't edit it or understand how to change the js file in place with an edited one.

Can anyone save me?

  • How about this issue? – Khoa TruongDinh Sep 24 '16 at 2:01
  • Sorry, I have not had the chance to check it out. For some reason the logger php file in Checkout has erased itself (no more long nights for me) need to solve this issue before i can continue. – N. Mantel Sep 24 '16 at 13:08

From my understanding, you want to override vendor/magento/module-checkout/view/frontend/web/js/model/place-order.js. Basically, you can override the Javascript via Require Js - requirejs-config.js in our module. The requirejs config for all configs will be generated under pub/static/_requirejs. So, may we need to delete the requirejs config in this folder. And then, refresh our page, Magento will generate the new one with our custom js.

An simple example:

--Create a custom module Vendor/Module.
--Override place-order.js:


var config = {
    map: {
        '*': {

--Create our custom js: app/code/Vendor/Module/view/frontend/web/js/model/place-order.js.

Why we use some "shortcuts" in our requirejs config?

This is because, the js and html template will be load from pub/static.

  • Can I replace the js file with a new one in the same module? Is it required to create a new module just for one file? – N. Mantel Sep 24 '16 at 13:41
  • I'm confused about your question: Can I replace the js file with a new one in the same module?. – Khoa TruongDinh Sep 24 '16 at 14:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.