You can easily select a taxonomy category ID via the UI:
However, where can you read this ID via the API? I've retrieved the product before and after a category change, and the only thing that changes is the updated_at
value. I've compared all associated metafields, and nothing changes there, either.
It is only accessible via GraphQL queries. It is under the category
field:
query {
product(id: "gid://shopify/Product/<product_id>") {
productType
category {
name
id
}
}
}
Response:
{
'data': {
'product': {
'productType': 'Insulated Jackets',
'category': {
'name': 'Trucker Jackets',
'id': 'gid://shopify/TaxonomyCategory/aa-1-10-2-14'
}
}
},
'extensions': {
'cost': {
'requestedQueryCost': 2,
'actualQueryCost': 2,
'throttleStatus': {
'maximumAvailable': 20000.0,
'currentlyAvailable': 19998,
'restoreRate': 1000.0
}
}
}
}