-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from lsimeonov/fix/extend-extension-attributes
Keep existing extension attributes when extending shipping payload request
- Loading branch information
Showing
7 changed files
with
57 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
view/frontend/web/js/mixin/shipping-payload-extender-mixin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
define([ | ||
'mage/utils/wrapper', | ||
'Klaviyo_Reclaim/js/model/shipping-payload/assigner' | ||
], function (wrapper, assignData) { | ||
'use strict'; | ||
|
||
/** | ||
* This file works on Magento >= 2.2.2 only. | ||
* | ||
* @param {Object} target | ||
* @return {Object} | ||
*/ | ||
return function (target) { | ||
return wrapper.wrap(target, function (parentFunction, payload) { | ||
parentFunction(payload); | ||
|
||
assignData(payload.addressInformation); | ||
|
||
return payload; | ||
}); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
define([ | ||
'jquery', | ||
'underscore', | ||
], function ($,_, registry) { | ||
'use strict'; | ||
|
||
return function (container) { | ||
var kl_sms_consent = $('[name="custom_attributes[kl_sms_consent]"]').is(':checked'); | ||
var kl_email_consent = $('[name="custom_attributes[kl_email_consent]"]').is(':checked'); | ||
|
||
container.extension_attributes = _.extend( | ||
container.extension_attributes || {}, | ||
{ | ||
kl_sms_consent: kl_sms_consent, | ||
kl_email_consent: kl_email_consent | ||
} | ||
); | ||
}; | ||
}); |
69 changes: 0 additions & 69 deletions
69
view/frontend/web/js/model/shipping-save-processor/default.js
This file was deleted.
Oops, something went wrong.