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

Solved
rossbrown
Shopify Partner
3 0 2

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.

Accepted Solution (1)
lizk
Shopify Staff
Shopify Staff
246 57 62

This is an accepted solution.

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.

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 4 (4)
lizk
Shopify Staff
Shopify Staff
246 57 62

This is an accepted solution.

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.

To learn more visit the Shopify Help Center or the Community Blog.

emartinello
Shopify Partner
1 0 0

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?

ritx
Shopify Partner
1 0 0

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.

Lishan
Shopify Partner
13 1 2

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.