# GET location\_id of new location created during product\_create

**URL:** https://community.shiphero.com/t/get-location-id-of-new-location-created-during-product-create/2914
**Category:** GraphQL API
**Created:** [May 10, 2024, 5:11pm UTC](https://community.shiphero.com/t/get-location-id-of-new-location-created-during-product-create/2914 "2024-05-10T17:11:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://community.shiphero.com/u/Raj)
#### Post date: [May 10, 2024, 5:11pm UTC](https://community.shiphero.com/t/get-location-id-of-new-location-created-during-product-create/2914/1 "2024-05-10T17:11:34Z")

</div>

Hi,

I’m using the below mutation to create new sku, and assigning it a new (not already existing) location. So far it was working well.  
I just added the ‘location\_id’ to the query, but now it fails as I’m surely doing something wrong. Could you pls help me understand how to change it such that the reply contains the location\_id field?

```auto
	  product_create(
		data: {
		  sku: "XXXX"
		  name: "XXXX"
		  price: "0.00"
		  customer_account_id: "XXXX"
		  barcode: "XXXX"
		  product_note: "XXXX"
		  warehouse_products: {
			warehouse_id: "XXXX"
			on_hand: "XXXX"
			inventory_bin: "XXXX"
			reserve_inventory: 0
			replenishment_level: 1
			reorder_level: 1
			reorder_amount: 1
			custom: false
		  }
		})
		{
		request_id
		complexity
		product {
		  id
		  legacy_id
		  sku
		  name
		  price
		  account_id
		  barcode
		  warehouse_products {
			warehouse_id
			legacy_id
			on_hand
			inventory_bin
			locations {
				location_id
			}
		  }
		}
	  }

```

Thanks so much!  
Raj

---

<div class="post-metadata">

### Author: ![tomasfd](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tomasfd](https://community.shiphero.com/u/tomasfd)
#### Post date: [May 13, 2024, 7:55pm UTC](https://community.shiphero.com/t/get-location-id-of-new-location-created-during-product-create/2914/2 "2024-05-13T19:55:34Z")

</div>

Hi @Raj! You were missing the edge in the location, the mutations should look like this:

```auto
mutation {
  product_create(
    data: {
      sku: "XXXX"
      name: "XXXX"
      price: "0.00"
      customer_account_id: "XXXX"
      barcode: "XXXX"
      product_note: "XXXX"
      warehouse_products: {
        warehouse_id: "XXXX"
        on_hand: 1
        inventory_bin: "XXXX"
        reserve_inventory: 0
        replenishment_level: 1
        reorder_level: 1
        reorder_amount: 1
        custom: false
      }
    }
  ) {
    request_id
    complexity
    product {
      id
      legacy_id
      sku
      name
      account_id
      barcode
      warehouse_products {
        warehouse_id
        legacy_id
        on_hand
        inventory_bin
        locations {
          edges {
            node {
              location_id
              created_at
            }
          }
        }
      }
    }
  }
}

```

Have a nice day!

---

<div class="post-metadata">

### Author: ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://community.shiphero.com/u/Raj)
#### Post date: [May 13, 2024, 8:46pm UTC](https://community.shiphero.com/t/get-location-id-of-new-location-created-during-product-create/2914/3 "2024-05-13T20:46:13Z")

</div>

THANK YOU @tomasfd ! It worked perfectly!
