I'm struggling to override or get in the middle of some checkout action scripts, for example the place-order method of app/code/Magento/Checkout/view/frontend/web/js/view/review.js

I can see there is a "beforePlaceOrder" variable in there but I'm unsure how to subscribe my own method there.

2 Answers 2


If you need to overwrite a function instead a class method (I used to overwrite Magento_Checkout/js/action/place-order).


var config = {
    config: {
        mixins: {
            'Magento_Checkout/js/action/place-order': {
                'My_Module/js/action/place-order': true


define(['mage/utils/wrapper'], function (wrapper) {
    'use strict';

    return function (placeOrderAction) {
        return wrapper.wrap(placeOrderAction, function (originalAction, paymentData, redirectOnSuccess) {
            // my own code here
            return originalAction(paymentData, redirectOnSuccess);

The code you described is not in magento 2 anymore. Checkout has been modified.

You can substitute any action (and any requireJs component) using requireJs map configuration (http://requirejs.org/docs/api.html#config-map) in magento requireJs config files.

Interception (or mixins) feature is not yet implemented for JS) but it's in development right now and will be delivered pretty soon.


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.