What GTIN is
GTIN is the GS1 standard global identifier for trade items, and Schema.org Product accepts it through five properties: the generic gtin plus the length-specific gtin8, gtin12, gtin13 and gtin14. Google's Product documentation recommends the length-specific property whenever the merchant knows which one applies.
Shopify's Barcode field
Shopify exposes the GTIN as a single Barcode field on every product variant: Admin > Products > [product] > Variants > [variant] > Inventory > Barcode (ISBN, UPC, GTIN, etc.). The Liquid object is product.selected_or_first_available_variant.barcode (or variant.barcode in variant loops). Shopify does not validate the format — you can store any string. The validation happens downstream at Merchant Center, in the schema validator, and at Catalog ingestion.
Which gtin property to use
The decision tree per Schema.org and Google's recommendation: 8-character barcode emits gtin8, 12-character emits gtin12, 13-character emits gtin13, 14-character emits gtin14, ISBN-10 (10 chars) emits isbn AND gtin (Book subtype only), ISBN-13 (13 chars, starts with 978 or 979) emits gtin13 (it IS an EAN-13). Anything else (custom internal codes, MPNs) goes in mpn, not gtin.
JSON-LD example — length-aware gtin mapping
The block below detects the Barcode field's length and emits the correct gtin property. Paste inside main-product.liquid as part of your Product block (the one that replaces the theme's structured_data line), in place of a plain gtin line. The Liquid case statement handles the four GTIN lengths; any other length falls through with no gtin emission. The barcode goes through | json, which adds the quotes.
Merchant Center alignment
Google Merchant Center requires GTIN for most retail product categories (apparel exempted in some markets; handmade and vintage exempted globally). When Merchant Center has a GTIN in the feed and the storefront's Product JSON-LD emits a different GTIN — or no GTIN at all — the product gets flagged in Merchant Center diagnostics, and the listing can be suspended. The fix is consistency: same GTIN, same length-property, same product.
Validation
Rich Results Test against a PDP with gtin emitted should report Product detected, the gtin property parsed, zero errors. If the Barcode field holds something that isn't a GTIN (letters, spaces, hyphens, the wrong length), expect the test to flag the value as invalid; Google requires GTINs in numeric form. The Schema.org Markup Validator parses every gtin property as plain text and won't catch a bad value.
Shopify gotchas on GTIN
Four gotchas. First: storing internal SKUs in the Barcode field — these are NOT GTINs and should not be emitted to a gtin schema property. Use mpn for manufacturer codes, sku for internal codes. Second: hard-coding gtin13 when some products have UPC-A (12-digit). Use the length-aware branch. Third: forgetting that the barcode belongs to the variant. The product object has no barcode property. Use product.selected_or_first_available_variant.barcode (or variant.barcode in a variant loop). Fourth: leaving Barcode empty on handmade/vintage products and then emitting an empty gtin field — wrap the emission in a Liquid conditional.