Urgent.News

What's breaking now, across thousands of outlets.

Tech

The Shopify zero-price bug that breaks Merchant Center feeds

TL;DR Merchant Center's "Invalid value for category [price]" fires whenever the price attribute Google receives is exactly 0; the only documented exception is mobile devices sold under a contract promotion. On Shopify the zero comes from one of two unrelated causes: an unfilled variant price (a data issue, no code involved) or a theme's JSON-LD snippet reading a variable that can resolve to empty…

Google flags product listings on Shopify as having an invalid price when the price attribute it receives is exactly 0. This error occurs in two main scenarios:

1. When a variant price is unfilled or missing in the Shopify admin interface. This is a data issue and can be resolved by simply filling in the missing price.

2. When a Shopify theme's JSON-LD structured data snippet is incorrectly reading a variable that can resolve to an empty value, even if the actual price is correct in the admin. This requires a code fix to ensure the theme is using the correct product.price or product.variants.first.price variables.

The bug is difficult to detect because it often affects only a small subset of product pages within a store, making it easy to miss during routine spot checks. Across 90,000+ Shopify product pages, roughly 1 in 5 stores had at least one affected page. Spot-checking individual products rarely uncovers the issue, as the zero price is usually hidden in one variant of a product.

To identify the cause, run the product URL through Google's Rich Results Test to see the actual price Google receives. Then check every variant price in Shopify Admin to see if any are missing. If the prices are correct in admin but still flagged as invalid by Google, the issue lies in the theme's JSON-LD snippet, which needs to be corrected to use product.selected_or_first_available_variant.price instead of a potentially empty variable.

Fixing the data issue is straightforward - fill in the missing variant price. For the code issue, update the theme's JSON-LD snippet to consistently use the correct price variable. After making the necessary changes, run the Rich Results Test again and confirm the zero price issue is resolved. The fixes should then propagate through Shopify's Merchant Center feed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Monday 24 August →