Discuss all the new features introduced with the new product model in GraphQL.
Hi everyone
Bit of a long shot, I have spent weeks on this query
I want to run a single query, this gets the first product.
Now I dont want just the product, i want everything connected to that product and i mean everything.
Currently I can get the first product and with it
product details
image details
media details (video's etc)
variants
product options inside variants
option values inside the product options
I need to be able to get the InventoryItem and InventoryLevel - these are the missing bits.
Everytime i think i am getting close, i constantly get quantity no longer exists, quantities requires names,
I just want a single query to return everything about the first product
I have the pagenext working, that took some brain power - it shouldnt off.
Any help would be appricated, thanks
I have attached a screen shot of what i am working on, I can get the quanities returned in a round about way but i need to know the inventoryitemid, the inventotylevelid (gid's)
Many thanks
Dave.
Hi @PremierEPOS
Can the following code meet your needs?
query getProduct ($id: ID!){
product(id: $id) {
title
tags
handle
availablePublicationsCount{
count
precision
}
category {
id
name
level
isLeaf
}
description
onlineStoreUrl
compareAtPriceRange{
maxVariantCompareAtPrice{
currencyCode
amount
}
minVariantCompareAtPrice{
currencyCode
amount
}
}
defaultCursor
featuredImage{
altText
url
}
hasOnlyDefaultVariant
hasOutOfStockVariants
hasVariantsThatRequiresComponents
requiresSellingPlan
isGiftCard
legacyResourceId
images(first: 10){
edges{
node{
id
src
altText
}
}
}
updatedAt
variantsCount{
count
precision
}
variants(first: 10){
edges{
node{
id
title
displayName
price
compareAtPrice
image {
id
url
}
inventoryItem {
countryCodeOfOrigin
id
createdAt
duplicateSkuCount
harmonizedSystemCode
inventoryHistoryUrl
inventoryLevel(locationId: "gid://shopify/Location/69855576286"){
id
canDeactivate
createdAt
deactivationAlert
location{
isActive
}
}
locationsCount{
count
precision
}
measurement{
id
weight{
unit
value
}
}
provinceCodeOfOrigin
requiresShipping
sku
tracked
unitCost{
amount
currencyCode
}
updatedAt
}
inventoryPolicy
inventoryQuantity
}
}
}
variantsCount{
count
precision
}
options(first: 10){
id
linkedMetafield{
key
namespace
}
name
values
optionValues {
id
linkedMetafieldValue
name
hasVariants
swatch{
color
image{
fileStatus
}
}
}
position
}
totalInventory
seo{
title
description
}
status
tags
vendor
}
}