When I add configurations to a configurable product the options get the sku undefined+attribute and not the name or sku of the configurable product. See screenshot below
Magento version: 2.1.10
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityIn my case, I have disabled the "SKU" field and this was the problem
If you look into the vendor/magento/module-configurable-product/view/adminhtml/web/js/variations/variations.js::getProductValue()
there is a selector with :enabled
prop.
I fixed this by writing mixin in my custom module
app/code/MyCompany/MyModule/view/adminhtml/requirejs-config.js:
var config = {
config: {
mixins: {
'Magento_ConfigurableProduct/js/variations/variations': {
'MyCompany_MyModule/js/variations/variations': true
}
}
}
}
app/code/MyCompany/MyModule/view/adminhtml/web/js/variations/variations.js:
define(
[
'uiComponent',
'jquery'
],
function (Component, $) {
'use strict';
return function (Variations) {
return Variations.extend(
{
/**
* @param {String} name
* @return {String|Number|Array}
*/
getProductValue: function (name) {
name = name.split('/').join('][');
return $('[name="product[' + name + ']"]:not(.ignore-validate)', this.productForm).val();
}
}
);
}
}
);