cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when setting both Default Billing and Default Shipping addresses

Issue when setting both Default Billing and Default Shipping addresses

Hi,

There seems to be an issue when trying to update/add a contact and set their default billing and default shipping in a single request with the Magento 2's Admin API. In the parameters I have set the addresses and used default_billing & default_shipping which have been set to True, but in the api response only one of these default addresses get set. Sometimes the default_billing is set but not the default_shipping or sometimes the default_shipping is set but not the default_billing. 

 

Below is an example of the parameters I have sent the API and the response I have received. Despite setting both default_billing & default_shipping in the parameters, the response only returned the default_shipping. I believe this is a bug.

 

Parameters:

{
  "customer": {
    "id": "4792",
    "email": "lan-test@a2zcloud.eu.com",
    "firstname": "Bradley",
    "lastname": "Duncan",
    "addresses": [
      {
        "telephone": "N/A",
        "firstname": "Bradley",
        "lastname": "Duncan",
        "street": [
          "40 Boughton Rd"
        ],
        "city": "WHYGATE",
        "postcode": "NE48 8SZ",
        "region": {
          "region_code": "wiltshire",
          "region": "wiltshire",
          "region_id": 0
        },
        "region_id": 0,
        "countryId": "GB",
        "default_billing": true
      },
      {
        "telephone": "N/A",
        "firstname": "Bradley",
        "lastname": "Duncan",
        "street": [
          "24 milford street1"
        ],
        "city": "salisbury",
        "postcode": "SP1 2AP",
        "region": {
          "region_code": "wiltshire",
          "region": "wiltshire",
          "region_id": 0
        },
        "region_id": 0,
        "countryId": "GB",
        "default_shipping": true
      }
    ],
    "website_id": 1
  }
}

Response:

{
  "id": 4792,
  "group_id": 1,
  "default_shipping": "8667",
  "created_at": "2020-06-04 17:10:39",
  "updated_at": "2020-06-19 09:06:56",
  "created_in": "CW Store View",
  "email": "lan-test@a2zcloud.eu.com",
  "firstname": "Bradley",
  "lastname": "Duncan",
  "gender": 0,
  "store_id": 1,
  "website_id": 1,
  "addresses": [
    {
      "id": 8666,
      "customer_id": 4792,
      "region": {
        "region_code": "wiltshire",
        "region": "wiltshire",
        "region_id": 0
      },
      "region_id": 0,
      "country_id": "GB",
      "street": [
        "40 Boughton Rd"
      ],
      "telephone": "N/A",
      "postcode": "NE48 8SZ",
      "city": "WHYGATE",
      "firstname": "Bradley",
      "lastname": "Duncan"
    },
    {
      "id": 8667,
      "customer_id": 4792,
      "region": {
        "region_code": "wiltshire",
        "region": "wiltshire",
        "region_id": 0
      },
      "region_id": 0,
      "country_id": "GB",
      "street": [
        "24 milford street1"
      ],
      "telephone": "N/A",
      "postcode": "SP1 2AP",
      "city": "salisbury",
      "firstname": "Bradley",
      "lastname": "Duncan",
      "default_shipping": true
    }
  ],
  "disable_auto_group_change": 0,
  "extension_attributes": {
    "is_subscribed": false
  },
  "custom_attributes": [
    {
      "attribute_code": "extait_cookie_categories",
      "value": null
    }
  ]
}
1 REPLY 1

Re: Issue when setting both Default Billing and Default Shipping addresses

@lanadmina24d39 

 

You can raise this issue here:

 

https://github.com/magento/magento2

 

If you find this issue with current Magento latest version.

Manish Mittal
https://www.manishmittal.com/