Shopify Barcode Generator
Generate 1–500 GTIN-14 values with the existing 0 + 03 + 10 random digits + check digit format. The generation algorithm, random source, and 500-item limit are fixed.
Not GS1-licensed. Synthetic GTIN-14 for GMC custom and other tolerant channels etc. only. Not for Amazon or other strict GTIN channels that require GS1-verified codes.
Use the right mode
- Generate: no Shopify access. Use for a local list or CSV.
- Scan: read-only store scan. It creates an HTML summary and a review CSV only for variants with an empty barcode.
- Apply: reads the approved CSV again, rechecks every variant and barcode, writes only with
--execute, then verifies the stored value.
Read references/gtin-rules.md before generating. Read references/onboarding-guide.md only when store access is needed.
Commands
node <skill>/scripts/shopify-barcode-generator.mjs generate --count 20 --out barcodes.csv
node <skill>/scripts/shopify-barcode-generator.mjs init-env --store <shop>.myshopify.com --env skill-hub.env
node <skill>/scripts/shopify-barcode-generator.mjs connection-check --env skill-hub.env
node <skill>/scripts/shopify-barcode-generator.mjs scan --env skill-hub.env --out gap-report.html --csv gap-preview.csv --limit 200
node <skill>/scripts/shopify-barcode-generator.mjs apply --env skill-hub.env --input gap-preview.csv
node <skill>/scripts/shopify-barcode-generator.mjs apply --env skill-hub.env --input approved.csv --execute --out apply-results.csv
barcodes.csv begins with the standard barcode header. The disclaimer is printed in the terminal and included in the HTML report; it is deliberately not inserted as a non-CSV comment line.
Store workflow
- Use
init-env, then complete the read-only connection-check with read_products.
- Run
scan. It reads all products and variants, skips every existing barcode when generating candidates, and writes a maximum of 500 rows.
- Review
gap-preview.csv. Change only intended rows from approved=false to approved=true.
- Run
apply without --execute to inspect the row count. Obtain explicit merchant approval before the next command.
- Run
apply --execute. It blocks changed variants, duplicate barcodes, invalid GTIN-14 values, and product/variant mismatches; it then uses Shopify productVariantsBulkUpdate and verifies the result.
The input CSV columns are: productId, variantId, product, variant, sku, existingBarcode, proposedBarcode, action, approved. action=create is emitted by scan. overwrite is accepted only when existingBarcode exactly matches the current store value.
Connection errors
Only after a request fails; keep the selected access method.
- Network (
fetch failed, ETIMEDOUT, ECONNRESET, ENETUNREACH): never guess proxy ports. If the runtime is configured to use an approved proxy, retry once; otherwise ask the merchant to expose one to this process.
407: fix proxy credentials in the runtime secret store; never paste them in chat.
CLI_NOT_FOUND / ENOENT: resolve the configured CLI entry or platform command; this is a launcher error.
401/403 / invalid_client: check store, credentials, and app installation.
SCOPE_UPDATE_REQUIRED: show missing scopes, get approval, approve in Shopify, refresh token, retry.
shop_not_permitted: use an app permitted for this store; do not loop. GraphQL errors: fix query/input; do not retry blindly.
- Suggest another access method only after this path fails and the user agrees.
1---2name: shopify-barcode-generator3description: Generate local GTIN-14 barcode numbers for preview, audit missing Shopify variant barcodes, and apply an explicitly approved CSV preview. Use for Shopify barcode preparation and missing-barcode cleanup; it is not for GS1 or strict-channel identifiers.4license: MIT5---67# Shopify Barcode Generator89Generate 1–500 GTIN-14 values with the existing `0 + 03 + 10 random digits + check digit` format. The generation algorithm, random source, and 500-item limit are fixed.1011> Not GS1-licensed. Synthetic GTIN-14 for GMC custom and other tolerant channels etc. only. Not for Amazon or other strict GTIN channels that require GS1-verified codes.1213## Use the right mode1415- **Generate:** no Shopify access. Use for a local list or CSV.16- **Scan:** read-only store scan. It creates an HTML summary and a review CSV only for variants with an empty barcode.17- **Apply:** reads the approved CSV again, rechecks every variant and barcode, writes only with `--execute`, then verifies the stored value.1819Read `references/gtin-rules.md` before generating. Read `references/onboarding-guide.md` only when store access is needed.2021## Commands2223```text24node <skill>/scripts/shopify-barcode-generator.mjs generate --count 20 --out barcodes.csv25node <skill>/scripts/shopify-barcode-generator.mjs init-env --store <shop>.myshopify.com --env skill-hub.env26node <skill>/scripts/shopify-barcode-generator.mjs connection-check --env skill-hub.env27node <skill>/scripts/shopify-barcode-generator.mjs scan --env skill-hub.env --out gap-report.html --csv gap-preview.csv --limit 20028node <skill>/scripts/shopify-barcode-generator.mjs apply --env skill-hub.env --input gap-preview.csv29node <skill>/scripts/shopify-barcode-generator.mjs apply --env skill-hub.env --input approved.csv --execute --out apply-results.csv30```3132`barcodes.csv` begins with the standard `barcode` header. The disclaimer is printed in the terminal and included in the HTML report; it is deliberately not inserted as a non-CSV comment line.3334## Store workflow35361. Use `init-env`, then complete the read-only `connection-check` with `read_products`.372. Run `scan`. It reads all products and variants, skips every existing barcode when generating candidates, and writes a maximum of 500 rows.383. Review `gap-preview.csv`. Change only intended rows from `approved=false` to `approved=true`.394. Run `apply` without `--execute` to inspect the row count. Obtain explicit merchant approval before the next command.405. Run `apply --execute`. It blocks changed variants, duplicate barcodes, invalid GTIN-14 values, and product/variant mismatches; it then uses Shopify `productVariantsBulkUpdate` and verifies the result.4142The input CSV columns are: `productId`, `variantId`, `product`, `variant`, `sku`, `existingBarcode`, `proposedBarcode`, `action`, `approved`. `action=create` is emitted by scan. `overwrite` is accepted only when `existingBarcode` exactly matches the current store value.4344### Connection errors4546Only after a request fails; keep the selected access method.4748- Network (`fetch failed`, `ETIMEDOUT`, `ECONNRESET`, `ENETUNREACH`): never guess proxy ports. If the runtime is configured to use an approved proxy, retry once; otherwise ask the merchant to expose one to this process.49- `407`: fix proxy credentials in the runtime secret store; never paste them in chat.50- `CLI_NOT_FOUND` / `ENOENT`: resolve the configured CLI entry or platform command; this is a launcher error.51- `401/403` / `invalid_client`: check store, credentials, and app installation.52- `SCOPE_UPDATE_REQUIRED`: show missing scopes, get approval, approve in Shopify, refresh token, retry.53- `shop_not_permitted`: use an app permitted for this store; do not loop. GraphQL errors: fix query/input; do not retry blindly.54- Suggest another access method only after this path fails and the user agrees.