What is the correct way to determine whether a category is a “reporting category” vs a normal category?
Here is an example product, which is assigned the category “Baked Goodness”, and has a reporting category of “Pastries”:
Here is how these two categories are retrieved in the API:
Baked Goodness (“normal” category):
{
"category_data": {
"category_type": "REGULAR_CATEGORY",
"is_top_level": true,
"name": "Baked Goodness",
"online_visibility": true,
"parent_category": {
"ordinal": -2251662374731776
}
},
"created_at": "2024-03-29T16:40:17.392Z",
"id": "GBWQJWRRB5QFO7CJ75ROXA5W",
"is_deleted": false,
"present_at_all_locations": true,
"type": "CATEGORY",
"updated_at": "2024-03-29T16:40:17.392Z",
"version": 1711730417392
}
Pastries (reporting category):
{
"category_data": {
"category_type": "REGULAR_CATEGORY",
"is_top_level": true,
"name": "Pastries",
"online_visibility": true
},
"created_at": "2020-08-22T18:23:51.05Z",
"id": "HOIWOAPTYHLGBNA6SIWXGH3A",
"is_deleted": false,
"present_at_all_locations": true,
"type": "CATEGORY",
"updated_at": "2022-10-19T19:37:39.34Z",
"version": 1666208259340
}
We don’t see much to distinguish them, in particular:
- both have
.type == "CATEGORY"
- both have
.category_data.category_type == "REGULAR_CATEGORY"
The only difference seems to be that the “normal” category has a .category_data.parent_category.ordinal
field. It seems like that could be a difference, but we don’t know why (& it feels brittle).
What’s the right way to determine that a category is the reporting category of an item? Thanks!