I would like turn all my js overwrites into mixins. I'm trying to create a mixin for the following file:


But the function in there doesn't have a name

' return function (paymentData, messageContainer) {'

When googling and checking magento 2 docs I can't find anything about how to turn a function without a name into a mixin. Anyone have an idea?


I will assume you use extra module for purpose customises on place order js

In module you need define file requirejs-config.js




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

file YourVendor_ModuleName/js/action/place-order-mixin

], function ($, wrapper) {
   'use strict';

    return function (placeOrderAction) {

      /** Override default place order action */
       return wrapper.wrap(placeOrderAction, function (originalAction, paymentData, messageContainer) {
          //Your extras logic here
          //Add extended functionality here

          return originalAction(paymentData, messageContainer);
| improve this answer | |

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.