Remove Customer from Order: Graphql

Remove Customer from Order: Graphql

Walkerr
Shopify Partner
14 0 0

I want to remove customer from an order using Graphql. Currently I use admin rest api for this

const { admin, session } = await authenticate.admin(request);

const order = new admin.rest.resources.Order({session: session});

order.id = 450789469;
order.customer = null;
await order.save({
  update: true,
});

Admin Rest Api - Orders 

How can I do this in graphql?

 

I asked the dev assistant AI in shopify docs, and it gave me this

mutation UpdateOrderCustomer {
  orderUpdate(input: {id: "gid://shopify/Order/123456789", customer: null}) {
    order {
      id
      customer {
        id
      }
    }
    userErrors {
      field
      message
    }
  }
}

But it isn't working, because there is no param for customer.

Reply 1 (1)

irzum
Shopify Partner
7 0 3

were you able to do it using gql?