Link Categories to a Menu Item
This link can directly improve search relevance, increase consumer engagement, and it elevates the visibility of the Menu Item within the Weedmaps ecosystem.
A Category link is required.
You can link a Categories to a Menu Item by using any of the operations below:
Method | Description | Try It! |
---|---|---|
POST | Create a new Menu Item linked to the Category | POST Menu Item |
PATCH | Update a Category link on the Menu Item | PATCH Menu Item |
PUT | Upsert a new Menu Item linked to the Category | PUT Menu Item |
Every Menu Item must include at least one valid category_id
, available via the Category operations:
Method | Description | Try It! |
---|---|---|
GET | Retrieve all Categories | Retrieve Categories |
GET | Retrieve all Categories as a Taxonomy Tree | Retrieve Category Tree |
You can utilize the many
filters
parameters on these operation for search and discovery.
Send us the category_ids
category_ids
- The most reliable method.
- Retrieves the exact Categories by its unique Weedmaps identifier.
Send us the category_names
category_names
If you do not have Weedmaps Category identifiers, this additional property will attempt to match to a Category in the Weedmaps Taxonomy. Providing category_ids
is the preferred method and will provide the best results for Menu Item and overall Menu quality.
- Weedmaps performs a likeness search to match the categories by name.
- Unmatched names are silently ignored (no error returned).
Payload Example
category_ids
andcategory_names
are Mutually ExclusiveIf you do not have Weedmaps Category identifiers, this additional property will attempt to match to a Category in the Weedmaps Taxonomy. Providing
category_ids
is the preferred method and will provide the best results for Menu Item and overall Menu quality.
You can pass Category identifiers as the category_ids
or category_names
attribute in a Menu Item payload.
{
"category_ids": ["integer", "integer", "integer"],
"category_names": "string, string, string"
}
{
"category_ids": [1, 2],
"category_names": "Flower, Big Buds"
}
Common Error
A Menu Item can only have one Root Category link.
This occurs when the
category_ids
orcategory_names
provided contain more than one Root Category.
Sub-Categories
To associate a sub-category, you must list all of its parent category_ids
.
Steps to Do This:
-
Get the full Category Tree
Use the GET Category Tree endpoint.This will include:
category_id
name
slug
parent_id
-
Locate your sub-category
- Find the specific
category_id
of the sub-category you want to assign.
- Find the specific
-
Trace the Parent Hierarchy
- Starting from the sub-category, traverse upward using
parent_id
until you reach the root. - Collect all the
category_id
s from this path
root(L1) → sub-category (L2) → sub-category (L3)
- Starting from the sub-category, traverse upward using
-
Associate All Parent IDs
- When assigning the sub-category, include all these
category_ids
, not just the one for the sub-category itself.
- When assigning the sub-category, include all these
Sub-Category Assignment Example
If you're categorizing a menu item as a Ice Water Hash. Our Category taxonomy tree looks like:
// these are example category IDs
Concentrates (category_id: 1)
└── Solventless (category_id: 2)
└── Ice Water Hash (category_id: 3)
To successfully associate you should send:
"category_ids": [1, 2, 3]
Just the sub-category alone is insufficient and will return a HTTP 422
Error:
{
"errors": [
{
"status": 422,
"title": "Validation Failed",
"detail": "Categories must assign one and only one root category",
"source": {
"pointer": "categories"
}
}
]
}
Updated 4 days ago