How do UPC/EAN Bar Codes Work?
In short, barcodes are a simple, unique I.D. number for your product. Just like a phone has a phone number but with more digits. You'll need a unique barcode number for each variation of your product(s), so by color, size, weight, style etc etc.
Example 1: If you have 1 t-shirt in 5 colors, you need 5 barcodes. Now if each of those 5 colors also has 5 sizes each, then you need 25 barcodes (5x5).
Example 2: If you have 1 bottle of water, but a million quantity to sell, you only need 1 barcode number. You'll just print that 1 barcode out a million times or as long as you're manufacturing that product.
When you go to sell your product at a retailer (i.e. Whole Foods, Etsy, Google etc.), that retailer's on-boarding department will have you fill out a product information form. On that form is where you will put your company and product details as well as your 12-digit UPC (Or 13-digit EAN) bar code number. The retailer then manually enters that information into their inventory management computer. This way, when they scan your bar code at the register (or on their site), it calls up that data you entered in their system and gives you credit for the 1 sale and deducts 1 unit from their inventory.
The bar code is simply a link between your product and the product information form you fill out for each store that sells your product. The bar code number & bar code image itself does not contain any hidden data, names, prices etc. More on this topic and how to "register" your barcode here: (How to Register a Barcode)
Each store, website, database and P.O.S. system will be private, internal, and is usually not publicly editable. This means that in order for you to get into a store or get your data onto a particular website that you want, you will need to manually contact that store/site and ask them what you need to do to manually upload your data so that it appears on their system/servers.