Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/shopify

src/lib/fragments.ts

81 lines · 1015 B · TypeScript
export const PAGE_INFO_FIELDS = `
	pageInfo {
		hasNextPage
		hasPreviousPage
		startCursor
		endCursor
	}
`

export const MONEY_SET_FIELDS = `
	shopMoney { amount currencyCode }
`

export const PRODUCT_FIELDS = `
	id
	title
	handle
	status
	vendor
	productType
	tags
	createdAt
	updatedAt
	totalInventory
	description
	variants(first: 50) {
		nodes {
			id
			title
			sku
			barcode
			price
			compareAtPrice
			inventoryQuantity
		}
	}
`

export const ORDER_FIELDS = `
	id
	name
	email
	createdAt
	updatedAt
	displayFinancialStatus
	displayFulfillmentStatus
	note
	tags
	currentTotalPriceSet { ${MONEY_SET_FIELDS} }
	customer { id displayName email }
	lineItems(first: 50) {
		nodes {
			id
			title
			sku
			quantity
			originalUnitPriceSet { ${MONEY_SET_FIELDS} }
		}
	}
`

export const CUSTOMER_FIELDS = `
	id
	displayName
	firstName
	lastName
	email
	phone
	createdAt
	updatedAt
	numberOfOrders
	amountSpent { amount currencyCode }
	defaultAddress {
		id
		formatted
		city
		province
		country
		zip
	}
`