Skip to content

Commit 9fc22ff

Browse files
Navarr BarnierNavarr Barnier
authored andcommitted
Add a payload extender to the default shipping-save-processor
This will allow third party extensions to modify the payload for the shipping address selection process, with the goal being the easy addition of extension_attributes with as few extension conflicts as possible. By separating this out into it's own model (as opposed to including it in the result of the processor return), non-default processors will also be able to utilize it.
1 parent ecefd85 commit 9fc22ff

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ define([
1212
'Magento_Checkout/js/model/payment/method-converter',
1313
'Magento_Checkout/js/model/error-processor',
1414
'Magento_Checkout/js/model/full-screen-loader',
15-
'Magento_Checkout/js/action/select-billing-address'
15+
'Magento_Checkout/js/action/select-billing-address',
16+
'Magento_Checkout/js/model/shipping-save-processor/payload-extender'
1617
], function (
1718
ko,
1819
quote,
@@ -22,7 +23,8 @@ define([
2223
methodConverter,
2324
errorProcessor,
2425
fullScreenLoader,
25-
selectBillingAddressAction
26+
selectBillingAddressAction,
27+
payloadExtender
2628
) {
2729
'use strict';
2830

@@ -46,6 +48,8 @@ define([
4648
}
4749
};
4850

51+
payloadExtender(payload);
52+
4953
fullScreenLoader.startLoader();
5054

5155
return storage.post(
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
define([], function () {
2+
'use strict';
3+
4+
return function (payload) {
5+
payload.addressInformation['extension_attributes'] = {};
6+
7+
return payload;
8+
};
9+
});

0 commit comments

Comments
 (0)