Orders

The orders endpoints allow you to retrieve, create, update, and delete information about orders in a database.


List all Orders

This query allows you to retrieve a paginated list of all your orders. By default, a maximum of 25 orders are shown per page.

Arguments

  • Name
    query
    Type
    String!
    Description

    Supported filter parameters: order_by order_dir status financial_status fulfillment_status created_at product_id

  • Name
    after
    Type
    String
    Description

    Returns the elements that come after the specified cursor.

  • Name
    first
    Type
    String
    Description

    Returns up to the first n elements from the list.

Fields

  • Label
    Order!
    Description

    The Order! query type.

Request

POST
https://api.lightfunnels.com/graphql
query ordersQuery($first: Int, $after: String, $query: String!){
	orders(query: "order_by:id order_dir:desc", after: "WzVE4OTA5LDEe/4OTA5XQ==", first: 10){
		edges{
			node{
				id
				_id
				name
				total
				fulfillment_status
				financial_status
				customer {
					id
					full_name
				}
				cancelled_at
				date
				test
			}
		}
		cursor
		pageInfo{
			endCursor
			hasNextPage
		}
	}
}

Response

{
		"data": {
			"pagination": {
				"edges": [{
					"node": {
						"id": "T3JkZXI6MTgyNTE0",
						"_id": 182514,
						"name": "1608",
						"total": 10,
						"fulfillment_status": "fulfilled",
						"financial_status": "pending",
						"customer": {
							"full_name": "Yassir Ennazk",
							"id": "Q3VzdG9tZXI6MTkxMzUw"
						},
						"cancelled_at": null,
						"date": "3 days ago",
						"test": false,
						"__typename": "Order"
					},
					"cursor": "WzE4MjUxNCwxODI1MTRd"
				}]
			}
		}
	}

Retrieve an order

This query allows you to retrieve an order by providing their id.

Arguments

  • Name
    id
    Type
    Int!
    Description

    The order id.

Fields

  • Label
    Order!
    Description

    The Order! query type.

Request

POST
https://api.lightfunnels.com/graphql
	query orderQuery($id: Int!){
		order(id: $id){
			# Order type fields
		}
	}

Response

{
		"data": {
			"order": {
				"id": "T3JkZXI6MTgyNTE0",
				"_id": 182514,
				"name": "1608",
				"total": 10,
				"fulfillment_status": "fulfilled",
				"financial_status": "pending"
				...
			}
		}
	}

Update an Order

This query allows you to perform an update on an Order.

Arguments

  • Name
    id
    Type
    Int!
    Description

    The order id.

  • Name
    node
    Label
    InputOrder!
    Description

    The order node.

Fields

  • Label
    Order!
    Description

    The Order! query type.

Request

Post
https://api.lightfunnels.com/graphql
mutation updateOrderMutation($node: InputOrder!, $id: Int!){
		updateOrder(node: $node, id: $id){
			# Order type fields
		}
	}

Response

{
		"data": {
			"order": {
				"id": "T3JkZXI6MTgyNTE0",
				"_id": 182514,
				"name": "1608",
				"total": 10,
				"fulfillment_status": "fulfilled",
				"financial_status": "pending"
				...
			}
		}
	}

Cancel an Order

This query allows you to perform an cancel an Order.

Arguments

  • Name
    id
    Type
    Int!
    Description

    The order id.

  • Name
    reason
    Type
    String!
    Description

    The reason for cancelling.

  • Name
    notifyCustomer
    Type
    Boolean!
    Description

    Notifying the customer about the cancelling.

  • Name
    refund
    Type
    Boolean!
    Description

    The order refund.

Fields

  • Label
    Order!
    Description

    The Order! query type.

Request

Post
https://api.lightfunnels.com/graphql
mutation updateOrderMutation($id: Int!, $reason: String!, $notifyCustomer: Boolean!, $refund: Boolean!){
		cancelOrder(id: $id, reason: $reason, notifyCustomer: $notifyCustomer, refund: $refund){
			# Order type fields
		}
	}

Response

{
		"data": {
			"order": {
				"id": "T3JkZXI6MTgyNTE0",
				"_id": 182514,
				"name": "1608",
				"refunded_amount": 10
				...
			}
		}
	}