I'm trying to follow the example here
Magento 2 - Why do SKU not change dynamically in configurable product view page
to create a mixin for configurable products that will show dynamically a notification when the user selects an option that changes the price.
My task is very similar to the original post where the sku is changed but I haven't been able to make that example work or achieve what I'm trying to do.
I'm putting the relevant parts of the code here.
Vendor/Module/view/frontend/web/js/configurable-mixin.js
define([
'jquery',
'mage/utils/wrapper'
], function ($, wrapper) {
'use strict';
return function (targetModule) {
//code here is executed
var reloadPriceWrapper = wrapper.wrap(targetModule.prototype._reloadPrice, function (original) {
//code in here never gets executed
//call original method
var result = original();
//custom code to show a notification
console.log('test');
//return original value
return result;
});
targetModule.prototype._reloadPrice = reloadPriceWrapper;
return targetModule;
};
});
requirejs-config.js
var config = {
config: {
mixins: {
'Magento_ConfigurableProduct/js/configurable': {
'Vendor_Module/js/configurable-mixin': true
}
}
}
};
My mixin seems to be loaded in the page, but I don't see any part of the code inside the wrapped function execute at all and it seems targetModule.prototype._reloadPrice is undefined during the whole process which I assume is the reason it fails.
What could cause this issue?
I'm on Magento 2.3.1