Branded/Verified Menu Items

Now that we have a better understanding how menu item data is displayed in the Weedmaps UI, let's go ahead and create a menu item. We're going to start with the branded (verified) menu items workflow, attempting to recreate the item shown on the previous page. Our example Listing will have a WMID value of 123456789, which represents its menu ID.

📘

While the requests and responses here don't map to real data in the Weedmaps system, they will give you a solid understanding of what's expected.

Finding the Brand

The first thing we're going to want to do is find the brand "Brand" for this menu item. Once we have the brand, we can then locate the products belonging to that brand. We do this by hitting the /api/v1/brands/autocomplete endpoint, passing in a filter parameter matching our brand.

curl --globoff \
  --request GET \
  --url 'https://api-g.weedmaps.com/wm/v1/brands/autocomplete?term=Brand' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer [ACCESS TOKEN HERE]' \
[
  {
    "id": 1234,
    "label": "Brand",
    "value": "Brand"
  },
  {
    "id": 2345,
    "label": "Example Brand",
    "value": "Example Brand"
  },
  {
    "id": 3456,
    "label": "Super Brand Sample",
    "value": "Super Brand Sample"
  }
]

Locating the Product

Based on the response we received, we know the ID of the brand we're looking for is 1234. Let's use that ID to find some products. Since we know the name of our menu item — Orange Cookies — we can filter our results by that name.

curl --globoff \
  --request GET \
  --url 'https://api-g.weedmaps.com/wm/v1/brands/1234/products?name=Orange%20Cookies' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer [ACCESS TOKEN HERE]' \
{
  "meta": {
    "products_count": 2
  },
  "data": {
    "products": [
      {
        "id": 98765,
        "name": "Orange Cookies",
        "slug": "orange-cookies",
        "is_published": true,
        "description": "Some description about the menu item.",
        "updated_at": "2020-09-18T17:18:28Z",
        "avatar_image": {
          "original_url": "https://images.weedmaps.com/docs/examples/image.jpg"
        },
        "gallery_images": [],
        "reviews_count": 0,
        "rating_average": 0.0
      },
      {
        "id": 87654,
        "name": "Blood Orange Cookies",
        "slug": "blood-orange-cookies",
        "is_published": true,
        "description": "Some description about the menu item.",
        "updated_at": "2020-09-18T18:21:29Z",
        "avatar_image": {
          "original_url": "https://images.weedmaps.com/docs/examples/image.jpg"
        },
        "gallery_images": [
          {
            "original_url": "https://images.weedmaps.com/docs/examples/image.jpg"
          }
        ],
        "reviews_count": 1,
        "rating_average": 1.0
      }
    ]
  }
}

📘

Branded Products Selection UI

As an Integrator, there are a number of ways you can allow your retail clients to find and select a branded product to add to their menu. One way we've seen it done is by having two autocomplete inputs. The first input would autocomplete on the brand by using the term filter. Once the brand has been selected and the ID/slug has been identified, the second input can autocomplete against that brand's products endpoint by leveraging the name filter.

Once you've found the proper menu item ID for the branded product, we recommend storing that value in your system. You can then use that to make future requests and pull down information pertaining to it going forward.

Creating the Menu Item

We now have all the data we need from the Weedmaps side to create our verified menu item. Let's go ahead and send that along with the remaining attributes to the WMID of our Listing.

🚧

Must Provide At Least One Category

In order to create a menu item, you must provide at least one category. To learn more about finding and associating categories, please see the Categorization & Tagging section of the guides.

curl \
  --request POST \
  --url 'https://api-g.weedmaps.com/wm/v1/menu_items' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer [ACCESS TOKEN HERE]' \
  --header 'content-type: application/json' \
  --data '{
    "type": "menu_item",
    "data": {
      "attributes": {
        "name": "Orange Cookies",
        "brand_id": 1234,
        "published": true,
        "online_orderable": true,
        "product_id": 98765,
        "variants": [
          {
            "price": {
              "amount": "17.06",
              "currency": "USD"
            },
            "weight": {
              "value": 1,
              "unit": "g"
            }
          },
          {
            "price": {
              "amount": "53.63",
              "currency": "USD"
            },
            "weight": {
              "value": 3.5,
              "unit": "g"
            }
          },
          {
            "price": {
              "amount": "99.54",
              "currency": "USD"
            },
            "weight": {
              "value": 0.25,
              "unit": "oz"
            }
          },
          {
            "price": {
              "amount": "140.34",
              "currency": "USD"
            },
            "weight": {
              "value": 0.5,
              "unit": "oz"
            }
          },
          {
            "price": {
              "amount": "242.39",
              "currency": "USD"
            },
            "weight": {
              "value": 1,
              "unit": "oz"
            }
          }
        ]
      },
      "relationships": {
        "menu": {
          "data": {
            "id": "WMID_HERE",
            "type": "menu"
          }
        },
        "categories": {
          "data": [
            {
              "type": "category",
              "id": "a780af3d-bdfe-41ce-a782-20f2519fd7be"
            }
          ]
        }
      }
    }
  }'
{
  "id": 10237948,
  "type": "menu_items",
  "data": {
    "attributes": {
      "name": "Orange Cookies",
      "slug": "orange-cookies",
      "brand_id": 1234,
      "published": true,
      "online_orderable": true,
      "product_id": 98765,
      "description": "Some description here provided by the Brand.",
      "created_at": "2020-09-18T17:18:27Z",
      "updated_at": "2020-09-18T17:18:27Z",
      "avatar_image": {
        "original_url": "https://images.weedmaps.com/docs/images/example.jpg"
      },
      "license_type": "recreational",
      "is_badged": true,
      "brand_name": "Brand",
      "cannabanoids": {
        "thc": 28.3,
        "cbd": 0.1
      },
      "category_name": "",
      "picture_url": "",
      "original_picture_url": "",
      "avatar_image_url": "",
      "parent_category": "",
      "sub_category": "",
      "variants": [
        {
          "price": {
            "amount": "17.06",
            "currency": "USD"
          },
          "weight": {
            "value": 1,
            "unit": "gram"
          }
        },
        {
          "price": {
            "amount": "53.63",
            "currency": "USD"
          },
          "weight": {
            "value": 3.5,
            "unit": "gram"
          }
        },
        {
          "price": {
            "amount": "99.54",
            "currency": "USD"
          },
          "weight": {
            "value": 0.25,
            "unit": "ounce"
          }
        },
        {
          "price": {
            "amount": "140.34",
            "currency": "USD"
          },
          "weight": {
            "value": 0.5,
            "unit": "ounce"
          }
        },
        {
          "price": {
            "amount": "242.39",
            "currency": "USD"
          },
          "weight": {
            "value": 1,
            "unit": "ounce"
          }
        }
      ]
    }
  }
}

📘

Be sure to save the menu item's ID in your database so that you may perform updates/deletes on said item at a later date.

Updating Menu Items

Our menu item has been live for a little bit of time and now we're all out of the "1g" option. Let's update the item in Weedmaps to properly reflect this change.

curl \
  --request PATCH \
  --url 'https://api-g.weedmaps.com/wm/v1/menu_items/89761327' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer [ACCESS TOKEN HERE]' \
  --header 'content-type: application/json' \
  --data '{
    "type": "menu_item",
    "id": 89761327,
    "data": {
      "attributes": {
        "variants": [
          {
            "price": {
              "amount": "53.63",
              "currency": "USD"
            },
            "weight": {
              "value": 3.5,
              "unit": "g"
            }
          },
          {
            "price": {
              "amount": "99.54",
              "currency": "USD"
            },
            "weight": {
              "value": 0.25,
              "unit": "oz"
            }
          },
          {
            "price": {
              "amount": "140.34",
              "currency": "USD"
            },
            "weight": {
              "value": 0.5,
              "unit": "oz"
            }
          },
          {
            "price": {
              "amount": "242.39",
              "currency": "USD"
            },
            "weight": {
              "value": 1,
              "unit": "oz"
            }
          }
        ]
      }
    }
  }'

As you can see from this request, we're passing the entire variants hash again: This is because all the "attributes" within an object get overwritten when changed, unless otherwise specified. That being said, we now have an updated menu item without a "1g" variant available for purchase.

Deleting Menu Items

More time has passed since we updated our menu item, and now you no longer have a need for it. No problem! Just send a delete request for the item and we'll make sure it's removed.

curl --globoff \
  --request DELETE \
  --url 'https://api-g.weedmaps.com/wm/v1/menu_items/89761327' \
  --header 'accept: application/vnd.api+json' \
  --header 'authorization: Bearer [ACCESS TOKEN HERE]' \