Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I want to remove a customer from an order using GraphQL. Currently, I'm using the Admin REST API for this:
const { admin, session } = await authenticate.admin(request); const order = new admin.rest.resources.Order({ session }); order.id = 450789469; order.customer = null; await order.save({ update: true });
This works fine using the REST API, but I can't find the equivalent way to do this with GraphQL. Specifically, I tried the following mutation suggested by the Shopify docs assistant AI:
mutation UpdateOrderCustomer { orderUpdate(input: { id: "id", customer: null }) { order { id customer { id } } userErrors { field message } } }
However, this doesn't work because the customer parameter is not valid for the orderUpdate mutation.
How can I achieve this in GraphQL?
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025