How do I query Order.Returns.ReturnLineItems when it is ReturnLineItemType instead of ReturnLineItem

How do I query Order.Returns.ReturnLineItems when it is ReturnLineItemType instead of ReturnLineItem

FRBen
Visitor
1 0 0

Order.Returns has a connection to ReturnLineItems https://shopify.dev/docs/api/admin-graphql/2024-07/objects/Return#connection-returnlineitems

ReturnLineItems points to the type ReturnLineItemType https://shopify.dev/docs/api/admin-graphql/2024-07/interfaces/ReturnLineItemType

ReturnLineItemType does not contain the FulfillmentLineItem.LineItem.Sku which is what I need to complete my query.

This information is important because its used to compare a Order.LineItem SKU with a Return LineItem SKU to determine if the item in the order was returned. I am trying to determine this without writing an entire new query just to retrieve orders.

Is this possible?

Here is my query written in Go syntax:

type GraphQLOrder struct {
	ID                       string
	Test                     bool
	Name                     string
	Email                    string
	DisplayFinancialStatus   string
	DisplayFulfillmentStatus string
	ReturnStatus             string
	Note                     string
	ClientIP                 string
	ClosedAt                 *time.Time
	CancelledAt              *time.Time
	Tags                     []string
	CreatedAt                time.Time
	UpdatedAt                *time.Time
	CustomAttributes         []struct {
		Key   string
		Value string
	}
	Customer struct {
		Email string
	}
	LineItems struct {
		Nodes []GraphQLLineItem
	} `graphql:"lineItems(first: 100)"`
	Returns struct {
		Nodes []struct {
			ID                string
			Status            string
			totalQuantity     int64
			ExchangeLineItems struct {
				Nodes []struct {
					LineItem struct {
						SKU      string
						Name     string
						Quantity int64
					}
				}
			} `graphql:"exchangeLineItems(first: 10)"`
			// Returns only has connection to ReturnLineItemType which does not contain FulfillmentLineItem.LineItem
			/* 						ReturnLineItems struct {
				Nodes []struct {
					RefundableQuantity int64
					RefundedQuantity   int64
					ReturnReason       string
					ReturnReasonNote   string
					CustomerNote       string
													 FulfillmentLineItem struct {
						quantity int64
						LineItem struct {
							Name string
							SKU  string
						}
					} `graphql:"FulfillmentLineItem(first: 10)"`
				}
			} `graphql:"returnLineItems(first: 10)"` */
		}
	} `graphql:"returns(first: 10)"`
	Refunds []struct {
		ID              string
		CreatedAt       time.Time
		UpdatedAt       *time.Time
		Note            string
		RefundLineItems struct {
			Nodes []struct {
				Quantity    int64
				RestockType string
				LineItem    struct {
					SKU      string
					Name     string
					Quantity int64
				}
			}
		} `graphql:"refundLineItems(first:10)"`
	}
}

type OrdersGraphQL struct {
	Orders struct {
		Edges []struct {
			Node GraphQLOrder `graphql:"node"`
		}
		PageInfo struct {
			EndCursor   string
			HasNextPage bool
		}
	} `graphql:"orders(first: $first, after: $after)"`
}
Replies 0 (0)