In short
This task concerns online stores available in several languages or for several countries. An out-of-stock product must show as out of stock in every version that draws on the same stock, at the same time, on the page, in the Offer markup and in the product feeds. Setting it up means choosing the stock model (single or per market), checking that a product's translations really share that stock, and purging the caches of every language when it changes. If the site sells nothing online, the task does not apply.
Why it matters
On a multilingual store, each version of a product page is a separate page, often cached separately. Three mechanisms produce discrepancies:
- Duplicated stock: some multilingual plugins create one product per language. If synchronization is disabled or broken, the German version keeps a phantom stock while the French version sells out.
- Per-language caches: the sale triggers a purge of the page in the language where it took place, not in the other languages, which keep showing “In stock” for hours.
- Out-of-sync feeds: country feeds are generated at different times, or from a source other than the page.
Google requires the availability declared in the Merchant Center feed to match that of the landing page, and compares the page, its markup and the feed. A mismatch leads to warnings or product disapprovals in the country concerned. For the visitor, it means an order that cannot be placed or gets cancelled. The shopping features of generative engines also rely on this data: wrong availability in one language may be picked up there, although the vendors do not document exactly how.
What it improves
- Merchant Center Fewer availability mismatches between feeds and pages, in each country.
- Rich results The availability shown in each language is correct.
- Conversion Fewer blocked carts and fewer orders cancelled because of stock-outs.
- AI shopping answers Less risk of a sold-out product being presented as available. Undocumented effect.
- Rankings No direct effect.
How to check
Buy a test product, or set it out of stock in the admin, then read its availability in each language. This dependency-free Python script automates the reading: for each product page in the list, it follows the hreflang tags, reads the availability of the offers in the JSON-LD and reports the versions that diverge.
#!/usr/bin/env python3
"""Usage: python3 stocks.py fiches.txt > stocks.csv"""
import csv
import json
import re
import sys
import urllib.request
from urllib.parse import urljoin
HEADERS = {"User-Agent": "audit-stocks", "Cache-Control": "no-cache"}
LINK = re.compile(r"<link[^>]+>", re.I)
JSONLD = re.compile(r'<script[^>]+application/ld\+json[^>]*>(.*?)</script>', re.S | re.I)
def get(url):
with urllib.request.urlopen(urllib.request.Request(url, headers=HEADERS), timeout=20) as r:
return r.read().decode("utf-8", "replace"), r.headers.get("Age", "")
def availability(html):
found = set()
def walk(node):
if isinstance(node, list):
for item in node:
walk(item)
elif isinstance(node, dict):
if "availability" in node:
found.add(str(node["availability"]).rsplit("/", 1)[-1])
for value in node.values():
walk(value)
for block in JSONLD.findall(html):
try:
walk(json.loads(block))
except json.JSONDecodeError:
found.add("invalid JSON-LD")
return " ".join(sorted(found)) or "missing"
def alternates(html, base):
result = {}
for tag in LINK.findall(html):
lang = re.search(r'hreflang="([^"]+)"', tag)
href = re.search(r'href="([^"]+)"', tag)
if lang and href and lang.group(1) != "x-default":
result[lang.group(1)] = urljoin(base, href.group(1))
return result
writer = csv.writer(sys.stdout)
writer.writerow(["product_page", "language", "url", "availability", "age_cache_s", "status"])
for url in (line.strip() for line in open(sys.argv[1], encoding="utf-8") if line.strip()):
html, age = get(url)
versions = alternates(html, url) or {"source": url}
values = {}
for lang, other in versions.items():
page, age = (html, age) if other == url else get(other)
values[lang] = (other, availability(page), age)
distinct = {value[1] for value in values.values()}
for lang, (other, value, age) in values.items():
writer.writerow([url, lang, other, value, age, "MISMATCH" if len(distinct) > 1 else "ok"])
python3 stocks.py fiches.txt > stocks.csv
The script assumes that every version draws on the same stock. With stock per market, compare only the languages of the same market. The age_cache_s column picks up the Age header when a cache returns it: a mismatched page with a high age points to a cache that was not purged. The expression that reads the <link> tags assumes attributes in double quotes.
Compliant result: every line shows ok, a few seconds after a stock change. In Merchant Center, the product diagnostics must not report any availability mismatch between the feed and the page in any country.
How to implement
Before you start
Choose and write down the stock model, because it determines what must be identical:
| Model | Example | What must match |
|---|---|---|
| Single stock, all languages | Thé des Lisières ships everything from Nantes, site in French, German, English | Availability across every language version |
| Stock per market | Warehouse in France for the EU, warehouse in the United Kingdom for /en-gb/ |
The languages of the same market with each other, each market with its own feed |
| Single stock, sales restricted by country | Product not sold in Switzerland | Stock everywhere, and unavailability in the excluded country, see check availability by country (opens in a new tab) |
Fictional examples. In every case, the page, the JSON-LD and the feed for the same URL read the same value at the same time: see sync prices and stock across site, feeds and markup (opens in a new tab).
WordPress
Versions WordPress 6.5 and later, WooCommerce 9 and 10, November 2026.
WooCommerce Multilingual & Multicurrency (WPML) and Polylang for WooCommerce create one product per language but share stock between translations: a sale in one language decrements the stock of all of them. Check this with the test product: set the stock to zero in the source language, then open the product in the admin of each other language. If the stock differs, synchronization is disabled or an import wrote directly into a translation; reimport in the source language only.
That leaves the cache. A caching plugin generally purges the edited product page, not its translations. Add this purge in a custom plugin:
function tdl_translation_ids(int $productId): array
{
if (function_exists('pll_get_post_translations')) {
return array_map('intval', array_values(pll_get_post_translations($productId)));
}
$languages = (array) apply_filters('wpml_active_languages', null, []);
$ids = [];
foreach (array_keys($languages) as $code) {
$id = apply_filters('wpml_object_id', $productId, 'product', false, $code);
if ($id) {
$ids[] = (int) $id;
}
}
return $ids ?: [$productId];
}
function tdl_purge_product_translations(WC_Product $product): void
{
$productId = $product->get_parent_id() ?: $product->get_id();
foreach (tdl_translation_ids($productId) as $id) {
if (function_exists('rocket_clean_post')) {
rocket_clean_post($id);
}
do_action('litespeed_purge_post', $id);
clean_post_cache($id);
}
}
add_action('woocommerce_product_set_stock', 'tdl_purge_product_translations');
add_action('woocommerce_variation_set_stock', 'tdl_purge_product_translations');
rocket_clean_post is provided by WP Rocket and the litespeed_purge_post action by LiteSpeed Cache; replace them with your plugin's purge function. If pages go through a CDN that caches HTML, add a purge of their URLs (see Cloudflare).
Shopify
Versions Shopify, all plans, with Shopify Markets, November 2026.
Shopify does not create one product per language: a variant's stock is the same for every language, and each market sells the stock of the locations that serve it. There is nothing to synchronize between languages, and Shopify manages the page cache itself.
Check the theme: the availability in the JSON-LD must come from variant.available, like the buy button, and not from a value hard-coded in a section. If you generate country feeds with an app, check how often it updates stock.
PrestaShop
Versions PrestaShop 8 and 9.
Stock is held by the product and its combinations, common to every language: no synchronization is needed in a single store. In multistore mode, stock sharing between stores is set at the shop group level (Advanced Parameters > Multistore): share quantities between the stores that ship from the same warehouse. After a stock change, clear the cache if a module's or a proxy's page cache is active.
Magento
Versions Adobe Commerce and Magento Open Source 2.4.
With Inventory Management (MSI), a stock is assigned to a website (website), and every store view of that website, and therefore every language, shares this stock. For stock per market, create one website per market and assign its stock to it in Stores > Inventory > Stocks. Magento's full page cache invalidates the product's pages in every store view when the stock changes; check this with the script if Varnish or a CDN sits in front.
Cloudflare
Versions Cloudflare dashboard, all plans, November 2026.
If a cache rule caches the HTML of product pages (Cache Rules), a stock change only shows up once the cache expires. Purge the URLs of every language from the application, through the API:
curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"files":["https://example.com/thes/sencha-bio/","https://example.com/de/tee/bio-sencha/","https://example.com/en/tea/organic-sencha/"]}'
The token only needs the zone's cache purge permission. Otherwise, keep a short cache duration for the HTML of product pages.
Laravel
Versions Laravel 12 and 13.
Keep stock in a table with no notion of language: one row per variant (and per warehouse for stock per market). If you cache responses, with spatie/laravel-responsecache for example, forget the URLs of every language when the stock changes:
namespace App\Listeners;
use App\Events\StockUpdated;
use Spatie\ResponseCache\Facades\ResponseCache;
class ForgetProductPagesListener
{
public function handle(StockUpdated $event): void
{
$urls = collect(config('app.locales'))
->map(fn (string $locale): string => route('products.show', [
'locale' => $locale,
'slug' => $event->product->getTranslation('slug', $locale),
]))
->all();
ResponseCache::forget($urls);
}
}
Adjust the route name and the slug calculation to your routing.
Next.js
Versions Next.js 15 and 16 (App Router).
Tag the stock data with the same tag in every language, then invalidate that tag when the stock changes:
// app/[locale]/produits/[slug]/page.tsx
const stock = await fetch(`${process.env.API_URL}/stock/${product.id}`, {
next: { tags: [`stock-${product.id}`] },
}).then((r) => r.json());
// app/api/stock-webhook/route.ts
import { revalidateTag } from 'next/cache';
export async function POST(request: Request) {
if (request.headers.get('x-webhook-secret') !== process.env.STOCK_WEBHOOK_SECRET) {
return new Response('Forbidden', { status: 403 });
}
const { productId } = await request.json();
revalidateTag(`stock-${productId}`, { expire: 0 });
return Response.json({ revalidated: true });
}
{ expire: 0 } prevents the old value from being served again: the next request waits for fresh data, which suits stock. The 'max' profile, recommended for editorial content, would serve the stale page one more time. In Next.js 15, call revalidateTag with the tag alone, a form deprecated since Next.js 16. Since the tag is shared, the pages of every language are regenerated on their next request.
Good to know: if stock changes very often, do not cache availability in the HTML: display it from a lightweight request, but keep an up-to-date value in the HTML served to bots, because that is the one Google and Merchant Center read.
Common mistakes
- Importing stock into each language instead of the source language only, creating discrepancies that synchronization does not fix.
- Purging the cache of only the language where the sale took place.
- Generating the JSON-LD from a source other than the buy button, or keeping it cached longer than the page.
- Country feeds updated once a day for stock that changes every hour.
- Comparing markets with different stock and wrongly concluding that there is an anomaly.
- Leaving an unpublished product translation in stock in a country's feed.
Frequently asked questions
Why does the German version show “in stock” when the product is sold out?
Most often, it is a cache. The sale triggered a purge of the product page in one language, but the German version stayed cached in the plugin, the proxy or the CDN. More rarely, the German product has its own stock because translation synchronization is disabled. The Age header of the response and the stock displayed in the admin for each language let you tell which it is.
Does an international store need different stock for each country?
Only if the markets are served by different warehouses. A single stock is enough when everything ships from the same warehouse: every language version then shows the same availability. With one warehouse per market, each market shows its own stock, and only the languages of the same market need to match. Each country's Merchant Center feed must read the stock of its market.
Resources
- Google Search Central: merchant listing structured datadevelopers.google.com
- Google Merchant Center Help: availability attributesupport.google.com
- WPML: WooCommerce Multilingual & Multicurrencywpml.org
- Adobe Commerce: Inventory Management overviewexperienceleague.adobe.com
- Cloudflare: purge cached files by URLdevelopers.cloudflare.com
- Next.js: revalidateTagnextjs.org
- spatie/laravel-responsecachegithub.com
Updated on
Topic checklist (PDF)