My Products
Help

Unable to empty an optional address (Billing or Delivery address) on a Customer using the API

by ReinderReinders

I believe this is a functional oversight in the implementation of the Customer/PUT API call.

If I POST a new Customer and supply only a Main Address, the optional addressses (Billing or Delivery address) will have the checkbox "same as main" marked, and the underlying address will be the same Address record (same Id property) as the main record:

ReinderReinders_0-1695124680349.png

 

If I have created an existing Billing or Delivery address and want to empty it, there is no option in the PUT API to do so.

- supplying empty strings will throw an error (country must have a value)

- supplying null will not update the address record

- supplying the same data as the main record (overwrite the Billing address with the Main address) will result in a separate address record, and "same as main" will not be checked:

ReinderReinders_1-1695124943374.png

 

This matches the functionality as it is implemented in the screen. There is no way to empty a Country, because it must always have a value:

ReinderReinders_2-1695125040093.png

 

The way to empty a country in the screen is to manually check the "same as main" checkbox, this will overwrite the entire address record:

ReinderReinders_3-1695125134394.png

However, the Customer/PUT API call offers no way to influence this checkbox at all, which means I cannot mirror the screen functionality using API calls. It means that I am never able to empty a Billing/Delivery address.

 

 

 

3 REPLIES 3

by Yıldırım (Updated ‎03-10-2023 12:20 by Yıldırım VISMA )

Hello,  Customer > General Information > Country is a mandatory field.  That field is automatically populated, even creating a new Customer in the UI, therefore we can not override the value with null. This is valid for all related Country fields, also not possible with on-the-fly entry. 

Customers.jpg

Thank you, the original bug report is that there is no option to pass the "same as main" parameter through the API. So I am unable to simulate the action I would do in the screen within an API call.

Hei Reinder, we'll create a case to Expose "Same as main" option for the address & contact fields via Customer Endpoint