Validate Google Merchant Center product feeds
198
Validate Google Merchant Center product feeds before you upload them. It catches the mistakes that get products disapproved: missing required attributes, malformed prices, invalid GTINs, wrong availability values, broken links and images, and prices that don't match the landing page.
linux/amd64 and linux/arm64docker run --rm -v "$PWD:/work" avdeb/product-feed-validator products.xml
The current directory is mounted at /work, so pass file names relative to it. On Windows PowerShell use -v "${PWD}:/work".
Product Feed Validator 0.1.0
products.xml · RSS 2.0 · 4 items
Feed
warning "image_url" isn't a Merchant Center attribute and will be ignored (1 item). Did you mean "image_link"? [unknown_attribute]
Item 2 · id MUG-002 · line 16
error "$14.90" uses a currency symbol. Use the amount and an ISO 4217 currency code, e.g. "15.00 USD". [invalid_price]
error gtin "4006381333932" has an invalid check digit (expected 1). Check it for typos. [invalid_gtin_checksum]
warning link uses http://; use https:// where possible. [insecure_url]
Item 3 · id STK-001 · line 28
error availability_date is required when availability is preorder. [missing_availability_date]
error sale_price (4.90 USD) must be lower than price (3.90 USD). [sale_price_not_lower]
error id "STK-001" is also used by item 1; every product needs a unique id. [duplicate_id]
────────────────────────────────────────────────────────────
Items 4 total · 0 clean · 4 with errors · 0 with warnings only
Issues 18 errors · 8 warnings · 0 info
Result ✖ Fix the errors before uploading the feed to Merchant Center.
More examples:
# A feed URL, with link, image and landing-page checks on the first 50 items
docker run --rm avdeb/product-feed-validator -check-urls -check-landing https://example.com/feed.xml
# JSON report for scripts (redirect on the host, the container runs as non-root)
docker run --rm -v "$PWD:/work" avdeb/product-feed-validator -output json products.tsv > report.json
# From stdin, failing on warnings too
gunzip -c feed.xml.gz | docker run --rm -i avdeb/product-feed-validator -fail-on warning -
| Area | Checks |
|---|---|
| Required attributes | id, title, description, link, image_link, availability, price; unique ids |
| Text | Length limits (title 150, description 5000, id 50, …), ALL CAPS and promotional titles ("free shipping", "20% off"), HTML in titles |
| Prices | 15.00 USD format, ISO 4217 currency, currency symbols, comma decimals, price > 0, sale_price lower than price and in the same currency, sale_price_effective_date range |
| Availability | in_stock / out_of_stock / preorder / backorder, availability_date for preorder and backorder, ISO 8601 dates, expired expiration_date |
| Identifiers | GTIN digits, length (8/12/13/14) and GS1 check digit, reserved in-store/coupon prefixes, missing gtin/mpn/brand, conflicting identifier_exists |
| URLs and images | Absolute http(s) URLs, spaces, http vs https, unsupported image types (SVG, PDF), placeholder images, more than 10 additional images |
| Apparel | color, gender, age_group (and size for clothing and shoes) when google_product_category is Apparel & Accessories |
| Values | condition, gender, age_group, size_type, size_system, adult, is_bundle, multipack, identifier_exists |
| Shipping | Country codes and prices in shipping |
| Variants | item_group_id without variant attributes, duplicate variants in a group |
| Feed | Malformed XML/CSV with line numbers, column-count mismatches, unknown attributes with "did you mean" suggestions (image_url → image_link, colour → color, upc → gtin) |
-check-urls | Landing page and image HTTP status, content type, image dimensions (100×100 px, 250×250 px for apparel) |
-check-landing | Feed price and availability vs the page's schema.org Product offers or product:price meta tags (matches variants by SKU or GTIN) |
Severities: error means Merchant Center will likely reject the item or feed. Warning means it can limit performance or is probably a mistake. Info is advice.
GitHub Actions, with issues shown as annotations on the feed file:
- name: Validate product feed
run: docker run --rm -v "$PWD:/work" avdeb/product-feed-validator:0.1 feeds/products.xml -output github
JUnit report for CI dashboards:
docker run --rm -v "$PWD:/work" avdeb/product-feed-validator -output junit products.xml > feed-report.xml
Exit codes: 0 passed, 1 issues at or above -fail-on (default error), 2 usage or read error.
| Flag | Default | |
|---|---|---|
-format | auto | auto, xml, csv or tsv |
-output, -o | text | text, json, junit or github |
-out | Write the report to a file instead of stdout | |
-fail-on | error | Exit 1 on error, warning or never |
-max-items | 50 | Items listed in the text report (0 = all) |
-quiet | Text report: summary only | |
-no-color | Disable colours (also respects NO_COLOR) | |
-check-urls | Download link and image URLs | |
-check-landing | Compare price and availability with the landing page | |
-network-limit | 50 | Max items to run network checks on (0 = all) |
-concurrency | 4 | Parallel requests for network checks |
-timeout | 15s | Timeout per request |
-user-agent | product-feed-validator/<version> | User-Agent for HTTP requests |
Flags can go before or after the feed argument.
go install github.com/avdeb/product-feed-validator@latest
product-feed-validator products.xml
The checks follow Google's published product data specification. Some things need your Merchant Center account to check: account-level shipping and tax settings, policy reviews, website verification, and Google's own crawl of your pages. A clean report makes a smooth upload much more likely, but it doesn't guarantee approval.
MIT licensed. Issues and pull requests are welcome on GitHub. Made by AVDEB. More free developer tools, a product API and embeds: avdeb.com/developers
Content type
Image
Digest
sha256:fcc38406c…
Size
3.5 MB
Last updated
about 1 month ago
docker pull avdeb/product-feed-validator