Skip to main content
5 of 6
edited title
Magento2 Devloper
  • 2.1k
  • 2
  • 25
  • 59

Magento2.3.1 : Shipping address custom attribute value getting wrong format

Ref url - Shipping address custom attribute value not getting in RateRequest object in Carrier Model in magento2.x

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"

    .....

  2. 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?

Magento2 Devloper
  • 2.1k
  • 2
  • 25
  • 59