Multiple updateCustomer mutations with same "addresses" payload will remove address

I’m running into an issue with updating Customer addresses with the updateCustomer mutation. The first time I call updateCustomer with addresses in the payload, it updates the Customer as expected, adding the address and setting as the default. However, if I run the mutation again with the exact same payload, the Customer response comes back with an empty addresses array and no default address. This can be continued ad infinitum. Each time an address is submitted with the update that is identical to the existing default address of the Customer, it is removed entirely.

Here is a gist with the mutation and variables used to recreate the issue: https://gist.github.com/albatrocity/25d37436c864bc16162f836b10df978d

Is this a bug in the GraphQL Admin API or expected behavior? I would expect the second call to overwrite the customer’s addresses or to merge the new one into the existing list. Instead, it seems to blow away all associated addresses.

Hi

Thanks for flagging this issue!

The team is currently aware of this behaviour.

In the mean time the work around to for your expected functionality, the second call not removing the address, is to ensure you have the address id, of the address you would like to update in the input for the CustomerUpdate mutation.

Is the problem still not resolved? The ids are not present in the customer addresses, how can I update the addresses without risking deleting them?

Hi,

Any update on this issue? It really is a problem to have to query and verify each client and their addresses in any update, especially for bulk updates, it makes the purpose of the bulk update useless.

The problem still persists. Also the the address id is already deprecated so we can’t use that as suggested.. to get around the issue.

I ended up using REST API instead and it works well.

Hello,

Is there any hope that this bug will be fixed soon? All our developments have been done in REST and we are in the process of switching over to bulk mutations.

This malfunction calls our project into question. Thank you for the update, so that we can make the best decisions.

Why does a reply to this topic say "This is an accepted solution. ? The proposed workaround is not functional.

Have a nice day

I’ve found an acceptable workaround…

The bug does not occur if the data changes.

In the case where the new data is exactly the same, we have chosen to alternately feed the first name or the last name, with the value “first name + last name” and empty for the other field.

If it helps other people in the community…

@lizk
Same issue using GraphQL Admin API 2024-04. Here’s a Loom showing the behaviour. On subsequent customerUpdate calls, the address gets removed and then re-added, each time having a different ID.

https://www.loom.com/share/8bf9cf43c4ab4b62a2a2671b95a66585?sid=67495513-988d-4a20-b80e-7f33a20919f3

Great find @Lishan !
It puzzles me that the solution proposed by @lizk is now deprecated and we’re actually reverting to REST…
Isn’t Shopify wanting devs to adopt GraphQL?

this is not solved, can you change the status to not solved?

same issue here. @lizk do you have any updates?

Hi @victorvila ,

There’s no updates on this issue at this time. Though I can assure you that I have reached out to our developers again to ensure that issue is being investigated and worked on with the correct priority. That said due to the technical nature of issues such as these and the various parts of the platform any changes may affect, we are unable to provide any estimated timeframes for when this will be resolved.

In the meantime while our developers are looking into this further, for a workaround I may suggest making use of our new Customer Account API, which does have a customerAddressUpdate mutation that you can use to update the address specifically to prevent this issue from occurring.

I hope this helps, and I hope you have a great day :slightly_smiling_face: