Magento 2 How to get customer's order list using GraphQL

Magento sales module performs a wide variety of functions order, invoice and shipment management. Most of these functions are performed on the backend and the customer does not have access to this information. Today, we will show you how to get customer's order list using GraphQL in Magento 2.

Use the customerOrders query allows a customer to retrive their order histories.

Syntax

{customerOrders {CustomerOrders}}

Use the following query returns the order history of the logged in customer.

Request

saveCopyzoom_out_map
{ customerOrders { items { order_number id created_at grand_total status created_at } } }

Response

saveCopyzoom_out_map
{ "data": { "customerOrders": { "items": [ { "order_number": "000000003", "id": 3, "created_at": "2020-07-24 09:57:54", "grand_total": 15, "status": "pending" } ] } } }

That's it!!

If you are looking for more GraphQL solutions then check out our another article which is List of GraphQL Queries and Mutations for Magento 2.

I hope this article helps you to find what you were looking for.

Bookmark it for your future reference. Do comment below if you have any other questions on that.

P.S. Do share this article with your team.




Recent Articles
Tags
Newsletter
Chrome Extension
Copyright © 2024 devhooks.in All rights reserved.
Ads OFF toggle_off
wifi_off