enter image description here Above link in working perfect in magento2.2.x but not in magento2.3.1. I checked magento2.3.1 in they have changed something with custom_attribute code.
the issue is reproduce Step below 1. Add to cart product after going checkout Mobile Type select - Local Estimation shipping rate is - 5 USD and address array passed like
estimate-shipping-methods - 
 address:{
 city: "GA"
 country_id: "US"
 custom_attributes: [0: {attribute_code: "mob_type", value: "Local"}]
 firstname: "Test"
 lastname: "Dev"
 postcode: "30049"
.....
- Once back to checkout cart page change postcode I am getting an error -
Error occurred during "custom_attributes" processing. A custom attribute is specified with a missing attribute code. Verify the code and try again.
I checked post address in estimate-shipping-methods api and found data like
estimate-shipping-methods - 
 address:{
 city: "GA"
 country_id: "US"
 custom_attributes: [0: {attribute_code: "0", value: {attribute_code: "mob_type", value: "Local"}}]
 firstname: "Test"
 lastname: "Dev"
 postcode: "30049"
 .....
both custom_attributes arrays is different - so i checked core code and found custom_attributes: [0: {attribute_code: "0", value: {attribute_code: "mob_type", value: "Local"}}] is worng. attribute_code: "0" is extra adding so How can i fix this issue anyone have idea?
- 
 Could you find a solution?Marcelo Rodovalho– Marcelo Rodovalho2019年11月21日 09:25:13 +00:00Commented Nov 21, 2019 at 9:25
- 
 Yes you can check my profile in answer section.Magento2 Devloper– Magento2 Devloper2019年11月22日 10:28:53 +00:00Commented Nov 22, 2019 at 10:28
- 
 I couldn't find it. Can you just give me the link?Marcelo Rodovalho– Marcelo Rodovalho2019年11月22日 22:29:23 +00:00Commented Nov 22, 2019 at 22:29
- 
 magento.stackexchange.com/questions/216191/…Magento2 Devloper– Magento2 Devloper2019年11月24日 07:44:17 +00:00Commented Nov 24, 2019 at 7:44
- 
 I guess this is not related my friend.Marcelo Rodovalho– Marcelo Rodovalho2019年11月24日 22:24:56 +00:00Commented Nov 24, 2019 at 22:24
1 Answer 1
This appears to be a core bug to which I've opened an issue on github https://github.com/magento/magento2/issues/27505.
Currently I am using the following hotfix to allow checkout.
Index: vendor/magento/module-checkout/view/frontend/web/js/model/address-converter.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/magento/module-checkout/view/frontend/web/js/model/address-converter.js (revision 176ba2b75e443afb7f752ee28e7b751afec84bd3)
+++ vendor/magento/module-checkout/view/frontend/web/js/model/address-converter.js (date 1585595509144)
@@ -64,6 +64,15 @@
 addressData['custom_attributes'] = _.map(
 addressData['custom_attributes'],
 function (value, key) {
+
+ var alreadyBeenMapped = value instanceof Object
+ && value.hasOwnProperty('attribute_code')
+ && value.hasOwnProperty('value');
+
+ if (alreadyBeenMapped) {
+ return value;
+ }
+
 return {
 'attribute_code': key,
 'value': value
- 
 Magento will never accept own mistakes.Vipin Garg– Vipin Garg2020年05月18日 04:54:31 +00:00Commented May 18, 2020 at 4:54
Explore related questions
See similar questions with these tags.