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