As anyone who has done inventory management could tell you, the admin involved in keeping your pantry inventory up to date would massively outweigh any utility you'd get from this.
Yeah, I wrote a simple pantry manager that used both barcodes on the food items (used an api to lookup and pre-fill basic info) and then small QR codes that I added to the item (to track the individual instance), it was my "pandemic project". It was cool but not the most user friendly (unsurprising, UI/UX are not my strong suits) and it was a little tedious. It was relatively easy to write through and I enjoyed working on it. I was also tracking things like expiration with the intention to have a list of things I should focus on using first.
At the end of the day I abandoned it but the tech stack and the hardware I bought (small Dymo label printer) actually led to me building a side business on top of some of the basic ideas behind it which has grown steadily since.
Maybe it could be worth it for only some items that you always forget to use before they expire. or if it's for saving money by waiting for stuff to get on sale, maybe only for items that are really worth it.
I built this for my chest freezer years ago (including the domain chowcaster.com), which used a barcode scanner to add/remove items. It worked better than a pantry because 1. Less items and typically higher cost, 2. You usually make a trip to your freezer and 3. It's hard to know what's in there. It basically replaced the clipboard my mom still uses to track her freezer inventory.
At the end of the day I abandoned it but the tech stack and the hardware I bought (small Dymo label printer) actually led to me building a side business on top of some of the basic ideas behind it which has grown steadily since.