IThe bar code on the can can identify want store it was purchased, what register is was rang up on and what time it was sold and lo and behold you are on camera in the store at that register at that time buying the soup.
Bar codes are just a means to make numbers machine readable.
There are other systems, like the numbers on the bottoms of checks, for example, that allow machines to read numbers.
UPC codes, the bar-code you refer to, only have 12 digits that denote manufacturer and item number.
Any location information is derived from where the scan took place. There is no geographic info in a UPC.
Same for when it was sold, or to whom. That information is derived from the point-of-sale (POS).
Any information linking a purchaser to an item is done, for example, by the POS system - via you loyalty number (like store loyalty card) or credit information if that info is supplied by the purchasing card used.
There is no serial number differentiating one can of peas, from the one next to it.
There are other implementations of the same concept - EAN and JPN - for other locations.
There are uses of barcodes for serial numbers and lot information, etc. that also use a similar UPC looking format, but those don’t scan in typical POS transactions, except in specialty situations.