Hot answers tagged

46 votes
Accepted

How to rewrite widget function with mixins Magento 2.1.1

requirejs-config.js var config = { config: { mixins: { 'Magento_Swatches/js/swatch-renderer': { 'path/to/your/mixin': true } } } }; ...
Max's user avatar
  • 4,004
18 votes
Accepted

How Are the Things Magento 2 calls "mixins" Implemented?

I'd like to go straight to your questions and then I'll try to make it clear on what you can actually do with the mixins plugin. So, first things first. Implementation The main thing here is the ...
Denis Rul's user avatar
  • 196
13 votes
Accepted

What is mixin in Magento 2?

A mixin is a class whose methods are added to, or mixed in, with another class. A base class includes the methods from a mixin instead of inheriting from it. This allows you to add to or augment the ...
Kishan Patadia's user avatar
8 votes

How to load shipping methods on country and postcode change?

You have to add mixin for shipping-rates-validation-rules Add mixins in requirejs-config.js app/code/Vendor/ShippingModule/view/frontend/requirejs-config.js var config = { config: { ...
Prince Patel's user avatar
  • 22.6k
8 votes
Accepted

Magento 2 javascript plugin after method is executed in wrong time

If you look at target file Magento/Checkout/view/frontend/web/js/view/shipping.js,you'll see that this is requirejs module which returns UiComponent (child of Magento_Ui/js/form/form). In your ...
Max's user avatar
  • 4,004
7 votes
Accepted

Magento 2 - Override Mixin with another Mixin

You can disable original mixin and enable yours by putting this snippet in your module's requirejs config: var config = { config: { mixins: { 'mage/validation': { ...
Michał Biarda's user avatar
5 votes

Magento 2 javascript plugin after method is executed in wrong time

I'm not 100% sure, but I think mixins on ui components do not work as you are expecting it, since ui components return an ui component object which work slightly differtent, like further described ...
David Verholen's user avatar
5 votes
Accepted

When to use mixin js in magento2?

In your case, you don't need to use mixin js or override js. You can find in the method-group.js: vendor/magento/module-checkout/view/frontend/web/js/model/payment/method-group.js Title is a ...
bachlee89's user avatar
  • 1,287
4 votes

How to extend admin js in magento 2 by mixins

I am curious to know why would Magento won't allow using mixins on such file... any quick explanation about it?
Ezri's user avatar
  • 41
4 votes
Accepted

How to override price-utils.js specific method?

Using mixins is to follow the best practice. But in your script, should try: define([ 'jquery', 'underscore' ], function ($, _) { 'use strict'; return function (target) ...
Khoa TruongDinh's user avatar
4 votes

How Are the Things Magento 2 calls "mixins" Implemented?

To round out Denis Rul's answer. So, if you look at a Magento page, here are the three <script/> tags that load Magento. <script type="text/javascript" src="http://magento.example.com/...
Alana Storm's user avatar
  • 44.3k
3 votes
Accepted

.lib-url-check is undefined Magento 2.3 static content deploy error

The lib-url-check mixin has been removed by the look of it, therefore you need to update your LESS files. See this link for the commits - https://github.com/magento/magento2/search?p=1&q=lib-url-...
Ben Crook's user avatar
  • 15.6k
3 votes

Magento 2 combine two functionality s using a single mixin js file?

A mixin is a class whose methods are added to, or mixed in, with another class. A base class includes the methods from a mixin instead of inheriting from it. This allows you to add to or augment the ...
Hamendra Sunthwal's user avatar
3 votes

How to rewrite widget function with mixins Magento 2.1.1

Edit: my answer is not using mixins. To my knowledge, mixins only work for methods rewrites and properties. In your case, it's pure JS being called directly outside of a method. You can do it via a ...
Raphael at Digital Pianism's user avatar
3 votes

When to use mixins and when to use map?

The choice of which of those techniques to use is often relative and can be decided by general principles. There are a few exceptions when a mixin would not accomplish the goal and therefore, map must ...
bassplayer7's user avatar
  • 2,176
3 votes
Accepted

Can't get Magento2's .media-width() LESS mixin to work

Ok, so I discovered a little more about this but as @circlesix pointed out it's not possible to use these LESS mixins nested like this. Furthermore if you look at the <head> section of Magento ...
Holly's user avatar
  • 4,823
3 votes

Magento 2 - Override Mixin with another Mixin

I was able to solve it thanks to @Michał Biarda. There was a bug in the extension Dotdigitalgroup_Sms, they forgot to return $.mage.validation. So I have overriden it by mapping and fixed it. But ...
Black's user avatar
  • 3,150
3 votes
Accepted

Magento 2 Bundle Product Page - Remove Slide Down

To disable the slide down when clicking the Customize and Add to Cart button on the bundle product page, create a new JS mixin to override the default slideDown option in mage.slide JS widget to set ...
Tu Van's user avatar
  • 6,483
2 votes

How to override Magento 2 js using Mixins?

These some ways to overwrite core Magento 2 JS using mixin With js file returned $.mage.[widgetName] Your target file must be using $.widget: ex: source file: Magento_Checkout/js/shopping-cart ...
HoangHieu's user avatar
  • 1,338
2 votes
Accepted

Access Variables passed to a function modified/wrapped with a mixin

The arguments variable seemed to contain what i needed. After logging the object the specific element i needed seemed to be stored in: arguments[1][0] Final code: define([ 'jquery', 'mage/...
harri's user avatar
  • 5,415
2 votes
Accepted

How to extend admin js in magento 2 by mixins

You may not use js mixin for the particular js file you try to override (i.e /vendor/magento/module-sales/view/adminhtml/web/order/create/scripts.js). Also, your require-config.js declaration is ...
Pritam Biswas's user avatar
2 votes

Magento 2 : Creating JS Mixins for anonymous functions?

I will assume you use extra module for purpose customises on place order js In module you need define file requirejs-config.js path app\code\YourVendor\ModuleName\view\frontend\requirejs-config.js ...
mrtuvn's user avatar
  • 3,263
2 votes

mixin is not a function

You probably need to check and change the location of your mixin. Refer to the documentation Update: Remove single quotes in your mixins declaration: reference var config = { config: { ...
fmsthird's user avatar
  • 4,582
2 votes

How to extend admin js in magento 2 by mixins

Actually, there is another way to extend a class method that worked for me. Example: scripts-mixins.js define([], function () { 'use strict'; if (typeof AdminOrder !== "undefined") {...
Mykhailo Shatilov's user avatar
2 votes
Accepted

css and js not found in magento 2.3.5

Step -1 Go To Magento\Framework\View\Element\Template\File\Validator.php replace isPathInDirectories() Method protected function isPathInDirectories($path, $directories) { $realPath = ...
Rasik Miyani's user avatar
2 votes
Accepted

how to create a mixin js in magento

Two catches here with this type of mixin (there are a couple of ways to use mixins): The original Magento_Customer/js/model/customer/address returns a javascript function The object you are trying to ...
sdaugherty's user avatar
  • 1,209
1 vote

Magento 2 - advanced JS bundling mixins

I ran into the same problem. There is a patch to solve it. You can find out more here: https://github.com/magento/magento2/pull/25587 Download the mixins.js file from here: https://raw....
Trayan Grigorov's user avatar
1 vote

Magento 2 combine two functionality s using a single mixin js file?

I have tried this way and its working fine now requirejs-config.js var config = { config: { mixins: { 'Magento_Swatches/js/swatch-renderer': { '...
Nagaraju Kasa's user avatar
1 vote
Accepted

Magento 2 pass php session variable to minicart & hide proceed to checkout

If you want to pass your PHP SESSION variable data in your JS then please follow below steps : Create di.xml file here in your custom module app/code/Vendor/Module/etc/di.xml Content for this ...
Kishan Savaliya's user avatar
1 vote

Magento2 Mixins: How to write a requirejs-config.js?

What exactly do I need to add to the requirejs-config.js for adding a mixin? In theme - app/design/frontend/Vendor/theme/requirejs-config.js In module - app/code/Vendor/Module/view/frontend/requirejs-...
Denys Belevtsov's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible