跳到正文
DEV Community· Rayan·· 4 小時前AI 評分47

為何 Shopify 供應商試算表的 CSV 匯入會靜默失敗,以及如何用零依賴驗證器攔截問題

Why Shopify CSV Imports Fail Silently on Supplier Spreadsheets (and a Zero-Dependency Validator to Catch Them)

AI 導讀

Shopify 供應商試算表的 CSV 可能因重複 SKU、逗號小數或表頭尾隨空格等問題,靜默覆寫產品或令整個檔案遭拒;文章提供零依賴的 Node.js CLI 驗證器,讓用戶在匯入前檢查。驗證器會檢查必填表頭、SKU、價格、UTF-8 及箱裝定價用語,有問題時以 code 1 結束。另有支援最多 25,000 行、完全在瀏覽器端運作的 CSV 驗證器,以及可整理供應商檔案的 AI 工具。

正文

Rayan

If you've ever built or maintained a Shopify, WooCommerce, or PrestaShop store for a client using distributor price lists, you know the pain isn't clicking Import—it's what happens right after:

  • Duplicate Variant SKU rows silently overwriting existing products
  • European comma decimals (18,50) or "TBD" / "Call for price" strings breaking price parsing
  • Excel stripping UTF-8 characters into mojibake (é)
  • Trailing spaces in headers like "Variant Inventory Qty " causing Shopify to reject the whole file
  • Case vs. unit pricing traps (box of 12, 100pcs/box) slipping straight into live store margins

A Quick Zero-Dependency CLI Check

I open-sourced a lightweight Node.js CLI validator (0 dependencies) you can run locally or in CI before touching Shopify Admin:

👉 GitHub: github.com/rayantabara/shopify-csv-validator

git clone https://github.com/rayantabara/shopify-csv-validator.git
cd shopify-csv-validator
node index.mjs sample-broken.csv

It checks required Shopify headers (Handle, Title, Variant SKU, Variant Price), duplicate SKUs, non-numeric prices, comma decimals, broken UTF-8, and pack/case pricing phrases—exiting with code 1 if anything needs fixing.

Prefer a Browser UI (or Dealing with Supplier PDFs)?

If your vendor only sent a 40-page PDF price list or a multi-tab .xlsx file (or you don't want to clone a repo):

  • Free Unlimited Browser CSV Validator (up to 25,000 rows, 100% client-side): fichasync.app/shopify-csv-validator
  • Full AI Normalizer + Supplier Diff: fichasync.app turns raw supplier Excel/CSV/PDF sheets into clean Shopify, WooCommerce, or PrestaShop CSVs in ~2 minutes with deterministic Strict OEM SKU Lock and ephemeral Supplier Diff (compare a new tariff against your previous CSV in RAM to spot new SKUs, % price changes, and dropped items).

Would love feedback on edge cases you've hit with distributor spreadsheets!

來源:DEV Community · dev.to