What GTIN is
GTIN is the GS1 standard global identifier for trade items. The four common lengths: GTIN-8 (8 digits, small products like cosmetics), GTIN-12 / UPC-A (12 digits, US and Canada retail), GTIN-13 / EAN-13 (13 digits, Europe and international), GTIN-14 / ITF-14 (14 digits, packaging cases and cartons). ISBN-10 and ISBN-13 are book-specific GTINs. Schema.org also accepts the generic gtin property when the merchant doesn't know which length they're emitting; Google's Product documentation recommends the length-specific property when available.
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 the complementary Product block. The Liquid case statement handles the common lengths; unmatched lengths fall through with no gtin emission.
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. Common warnings: 'gtin format is invalid' (the value doesn't match the standard digit format — likely a non-digit character in the Barcode field). Schema.org Markup Validator parses all gtin properties as Text and doesn't validate the GTIN check-digit; Google's validator does.
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 variants have their own barcodes — product.barcode in some Liquid contexts returns the first variant's barcode, not the selected one. Use product.selected_or_first_available_variant.barcode for accuracy. Fourth: leaving Barcode empty on handmade/vintage products and then emitting an empty gtin field — wrap the emission in a Liquid conditional.