How to add location while creating purchase order via API


I’m trying to add location_id/location_name while creating purchase order via API using mutation purchase_order_create, but I’m getting error as In field line_items: In element #0: In field location_id: Unknown field.

The mutation I used is :

mutation {
    data: {
      po_date: "2020-09-24"
      po_number: "test-po"
      subtotal: "230.00"
      shipping_price: "0.00"
      total_price: "230.00"
      warehouse_id: "V345yZWhvdXNlOjY0NzE2"
      line_items: [
          sku: "TestSKU"
          quantity: 6
          expected_weight_in_lbs: "1.00"
          vendor_id: "VmVuZG9ye5YM1MzU2MA=="
          quantity_received: 0
          quantity_rejected: 0
          price: "200.00"
          product_name: "Product for testing Purchase Orders"
          fulfillment_status: "pending"
          sell_ahead: 0
      fulfillment_status: "pending"
      discount: "0.00"
  ) {

I’m getting error as :

"message": "Argument \"data\" has invalid value In field \"line_items\": In element #0: In field \"location_id\": Unknown field."

Please help me to add location details while creating purchase order.

Thanks in advance!

Hi @supritha!
The reason you are seeing the error is that we don’t have the ability to set a Location when creating the Purchase Order, because the location is chosen while in the process of receiving the items (and not when creating the purchase order)
Its something like the flow we have defined on

Let me know if this doesn’t help or if I could explain better.
Thanks in advance!


I get it now. Thanks much!

1 Like