diff --git a/vendor/magento/module-inventory-configurable-product-admin-ui/view/adminhtml/web/js/variations/steps/summary.js b/vendor/magento/module-inventory-configurable-product-admin-ui/view/adminhtml/web/js/variations/steps/summary.js index 74cc222a3886..e85c42ed6be0 100644 --- a/vendor/magento/module-inventory-configurable-product-admin-ui/view/adminhtml/web/js/variations/steps/summary.js +++ b/vendor/magento/module-inventory-configurable-product-admin-ui/view/adminhtml/web/js/variations/steps/summary.js @@ -6,8 +6,9 @@ define([ 'Magento_ConfigurableProduct/js/variations/steps/summary', 'jquery', + 'underscore', 'mage/translate' -], function (Summary, $) { +], function (Summary, $, _) { 'use strict'; return Summary.extend({ @@ -19,6 +20,32 @@ define([ $.mage.__('Price') ], quantityFieldName: 'quantityPerSource' + }, + + /** + * 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', + 'quantity_per_source' + ); + + if (productDataFromGrid.hasOwnProperty('quantity_per_source')) { + productDataFromGrid[this.quantityFieldName] = productDataFromGrid.quantity_per_source; + } + + delete productDataFromGrid.quantity_per_source; + + return productDataFromGrid; } }); });