Solved

is there shopify API to update the location.

bljd369
Tourist
5 0 4

Hi,

Is there any shopify API to update the location. We referred this doc https://shopify.dev/docs/api/admin-rest/2023-01/resources/location, however not able to find the update location API documentation there. 

 

We also tried by making a PUT request to  /admin/api/2021-09/locations/{location_id}.json and it gave us 404. Can you please help me here.

 

Thanks,

Balaji

 

 

Accepted Solution (1)
garyrgilbert
Shopify Partner
397 40 165

This is an accepted solution.

Well the bad news is that you can't update the location using the restapi.. the good news is that you can do it via graphql using the locationEdit mutation.

 

https://shopify.dev/docs/api/admin-graphql/2022-10/mutations/locationEdit

 

Since you have the location ID after creating the fulfillment service you can then update the information using graphql.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Replies 10 (10)

garyrgilbert
Shopify Partner
397 40 165

Hello,

 

You can not update a location via the API for locations created via the admin. You can only create/update locations if you are a fulfillment service provider.

 

See this documentation, which will let you manage a fulfillment service location

 

https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillmentservice

 

For mor information you can also read up on fulfillment services here:

https://shopify.dev/docs/apps/fulfillment/fulfillment-service-apps

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
bljd369
Tourist
5 0 4

Hi , Thanks your your reply :), the reason for trying to update the location is like that we were asked to migrate to new fulfillment workflow before July 1st. As part of that migration , we were supposed to create new fulfillment service , and whenever we create a fulfillment service, a location (with empty address) gets mapped to the fulfillment service automatically. Since the location which is mapped to the fulfillment service has empty address, we wanted to update the location with the correct address using the update API. Now, since, updating the location is not possible using API,  is it ok? if the fulfillment service is mapped to location (which has empty address). In the earlier workflow, products are mapped to locations where the inventory is supposed to be present, but as part of the new workflow, products are mapped to fulfillment service(instead of location), So, is it ok if the fulfillment service is mapped to location (which has empty address)

garyrgilbert
Shopify Partner
397 40 165

This is an accepted solution.

Well the bad news is that you can't update the location using the restapi.. the good news is that you can do it via graphql using the locationEdit mutation.

 

https://shopify.dev/docs/api/admin-graphql/2022-10/mutations/locationEdit

 

Since you have the location ID after creating the fulfillment service you can then update the information using graphql.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
bljd369
Tourist
5 0 4

thanks for the good news :), I will try using graphql

RafaelDeiro
Shopify Partner
2 0 1

Tried this solution, but the GraphQL API returns "Location not found.", however, I can query the location with the same ID and it works 100%, it just doesn't want to update.

 

I printed the results for both the fulfillmentService query and locationEdit mutation: 

Captura de tela 2023-06-05 150747.png

KlayThompson
Shopify Partner
5 0 0

The error I requested is the same as this one, did you solve this problem? 

It appears that the location of the new fulfillment_service does not support modification?

garyrgilbert
Shopify Partner
397 40 165

That location is part of a fulfilment service and probably can't be mutated directly through the location mutation.

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
KlayThompson
Shopify Partner
5 0 0

So there is no way to modify the location address of a fulfillment service, right?

Even if I want to modify this location as the customer's pick-up location

garyrgilbert
Shopify Partner
397 40 165

HI Klay,

 

Here from the documentation.

 

When an app registers a new FulfillmentService on a store, Shopify automatically creates a Location that's associated to the fulfillment service. To learn more about fulfillment services, refer to Manage fulfillments as a fulfillment service app guide.

 

so Shopify automatically creates the location.  I would think that it is not modifyable. But to be honest I haven't tried too either.

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
KlayThompson
Shopify Partner
5 0 0

In fact, I have tried all the solutions, but still can't modify the location. It seems that we can only wait for Shopify technical team to pay attention and give a solution