Admin API Request to update order shipping details

Solved

Admin API Request to update order shipping details

BAdam
Tourist
6 0 3

Hi, 

 

I know this was answered in the thread "Re: Add address to orders that do not require shipping"

 

But I'm trying to set up a flow to update order details for store pickups. However, I'm getting the following error for the orderUpdate mutation.

 

"Mutation had errors: "Variable $input of type OrderInput! was provided invalid value for id (Expected value to not be null)"

BAdam_0-1742419827950.png

Am I missing anything obvious? Any help would be appreciated.

 

Adam

 

 

Accepted Solution (1)

TikitaTech
Shopify Partner
75 18 18

This is an accepted solution.

Hi @BAdam!

 

You're right - the error message is telling you exactly what's missing: the order ID!

 

In your orderUpdate mutation, you need to include the "id" field in your input. Your current JSON is missing this required field.

 

Try updating your mutation input to include the order ID like this:

 

{
  "input": {
    "id": "{{ order.id }}",
    "shippingAddress": [
      "address1": "STORE PICK UP",
      "city": "STORE PICK UP",
      "countryCode": "AU",
      "firstName": "{{order.billingAddress.firstName}}",
      "lastName": "{{order.billingAddress.lastName}}",
      "phone": "0000000000",
      "provinceCode": "New South Wales",
      "zip": "2000"
    ]
  }
}

The Shopify API needs to know which order to update, and that's what the "id" parameter provides.

Once you add this, your mutation should work correctly for store pickups.

 

Hope this helps!

Daeda Wishlist - a simple wishlist
Co-founder @ Daeda Technologies PTE. LTD. to make tech simple

View solution in original post

Replies 2 (2)

TikitaTech
Shopify Partner
75 18 18

This is an accepted solution.

Hi @BAdam!

 

You're right - the error message is telling you exactly what's missing: the order ID!

 

In your orderUpdate mutation, you need to include the "id" field in your input. Your current JSON is missing this required field.

 

Try updating your mutation input to include the order ID like this:

 

{
  "input": {
    "id": "{{ order.id }}",
    "shippingAddress": [
      "address1": "STORE PICK UP",
      "city": "STORE PICK UP",
      "countryCode": "AU",
      "firstName": "{{order.billingAddress.firstName}}",
      "lastName": "{{order.billingAddress.lastName}}",
      "phone": "0000000000",
      "provinceCode": "New South Wales",
      "zip": "2000"
    ]
  }
}

The Shopify API needs to know which order to update, and that's what the "id" parameter provides.

Once you add this, your mutation should work correctly for store pickups.

 

Hope this helps!

Daeda Wishlist - a simple wishlist
Co-founder @ Daeda Technologies PTE. LTD. to make tech simple
BAdam
Tourist
6 0 3

Hi @TikitaTech,

 

Appreciate your help, that fixed it. Thankyou.