Browsed by
Tag: Js

How to override Magento 2 js using Mixins?

How to override Magento 2 js using Mixins?

A Magento 2 RequireJS “mixin” allows you to programmatically listen for the initial instantiation of any RequireJS, How to mixins in Magento 2 work? First, create requirejs-config.js var config = { config: { mixins: { ‘Magento_Checkout/js/model/quote’: { ‘PackageName_ModuleName/js/plugin-quote’: true } } } };   Magento_Checkout/js/model/quote js file you want to rewrite. PackageName_ModuleName/js/plugin-quote target file. plugin-quote.js /*global define*/ define([“jquery”], //defile more js here function ($) { ‘use strict’; var mixins = { getTotals: function () { //Define new content for getTotal() function…

Read More Read More

Follow by Email
Facebook
Facebook
LinkedIn