diff --git a/vendor/magento/module-configurable-product/view/adminhtml/web/js/variations/steps/summary.js b/vendor/magento/module-configurable-product/view/adminhtml/web/js/variations/steps/summary.js index f5c9382af0bc..240fa180fd87 100644 --- a/vendor/magento/module-configurable-product/view/adminhtml/web/js/variations/steps/summary.js +++ b/vendor/magento/module-configurable-product/view/adminhtml/web/js/variations/steps/summary.js @@ -135,20 +135,8 @@ define([ if (productId && !images.file) { images = product.images; } - productDataFromGrid = _.pick( - productDataFromGrid, - 'sku', - 'name', - 'weight', - 'status', - 'price', - 'qty' - ); + productDataFromGrid = this.prepareProductDataFromGrid(productDataFromGrid); - if (productDataFromGrid.hasOwnProperty('qty')) { - productDataFromGrid[this.quantityFieldName] = productDataFromGrid.qty; - } - delete productDataFromGrid.qty; product = _.pick( product || {}, 'sku', @@ -288,6 +276,32 @@ define([ * Back. */ back: function () { + }, + + /** + * Prepare product data from grid to have all the current fields values + * + * @param {Object} productDataFromGrid + * @return {Object} + */ + prepareProductDataFromGrid: function (productDataFromGrid) { + productDataFromGrid = _.pick( + productDataFromGrid, + 'sku', + 'name', + 'weight', + 'status', + 'price', + 'qty' + ); + + if (productDataFromGrid.hasOwnProperty('qty')) { + productDataFromGrid[this.quantityFieldName] = productDataFromGrid.qty; + } + + delete productDataFromGrid.qty; + + return productDataFromGrid; } }); });