Can't create fulfillment service due to location name.

Davis1
Shopify Partner
5 0 1

I'm having trouble understanding how to create fulfillment service with already existing location.

So there is this store which has location:

 

{
    "locations": [
        {
            "id": _loc_id_here_,
            "name": "Example",
            "address1": "England",
            "address2": "",
            "city": "UK",
            "zip": "W",
            "province": "",
            "country": "GB",
            "phone": "",
            "created_at": "2019-03-03T14:10:57+00:00",
            "updated_at": "2019-03-14T20:36:44+00:00",
            "country_code": "GB",
            "country_name": "United Kingdom",
            "province_code": null,
            "legacy": false,
            "active": true
        }
    ]
}

I'm trying to create fulfillment service for this store by posting this: 

 

{
  "fulfillment_service": {
    "inventory_management": false,
    "requires_shipping_method": true,
    "name": "Example",
    "tracking_support": false,
    "format": "json",
    "location_id":_loc_id_here_
  }
}

And I get this response 422 Unprocessable Entity:

{
    "errors": {
        "base": [
            "You already have a location with this name"
        ]
    }
}

 

I don't understand why I am getting this error. I'm trying to create a fulfillment service for existing location. Shouldn't this error appear if I tried to create a new location with the same name? 

Replies 5 (5)

Davis1
Shopify Partner
5 0 1

Just experimented with this on admin panel.

I have 2 locations with names:
`aaa`
`bbb`

I can rename `bbb` -> `aaa` and have 2 locations with the same name = `aaa`

 

However I can't create a new location with name `aaa` because the name is taken.

Davis1
Shopify Partner
5 0 1

Bumping this because it affects my integration a lot. 

m_r__sz
Visitor
1 0 0

@Davis1   any chance you solved it?

Davis1
Shopify Partner
5 0 1

I'm sorry but no. In our case the issue is very rare and it hasn't been fixed.

travisd
Shopify Partner
7 0 5

I've found the same thing, when testing out a fulfillment service on a test store when you add/remove the service multiple times, it leaves an orphan location, such that when you try to re-add the fulfillment service, this error is thrown.

 

You need to delete the orphan location associated with your service's handle, before adding the fulfillment service.

 

So, if your service handle is  "lightning", e.g.:

 

for l in shopify.Location.find():
 if l.name == 'lightning':
  l.destroy()

f = shopify.FulfillmentService()
f.callback_url = 'xxxxx'
f.handle = 'lightning'
f.format = 'json'
f.save()

 

Hope this helps! 🙂