Product-grid detection: facet-drawer heading becomes a product, names absorb whole card text, slugs drop accents
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with CommerceStructureRecognizer, html_product_grid_fallback, and ArtifactCompiler::runtimeDeclarationsFromFallbacks() named in the issue; trace how the reduced product card and facet drawer become entities. Add the neutral regression fixture to assert the product name, URL-derived transliterated slug, regular and sale prices, and that the drawer adds no product. Done when those assertions pass and the existing commerce fixture corpus stays green.
Written by the indexing model from the issue text.
Description
Summary
On a storefront collection page, product-grid detection (CommerceStructureRecognizer → html_product_grid_fallback → ArtifactCompiler::runtimeDeclarationsFromFallbacks()) produces wrong product entities in three ways. Measured on a 50-route import (100 entities in one generic/products/v1 declaration):
- A filter-drawer heading becomes a product. The heading of an off-canvas facet drawer,
FILTRAR <span>0 productos</span>("Filter · 0 products"), is emitted as products namedFiltrar 0 productos,Filtrar 15 productos, … (slugsfiltrar-0-productos,filtrar-15-productos). It appears on every collection page, so the false product collects onecommerce_collectionbinding per page (42 bindings, about 5.4 MB) and helps trigger #3184. - Product names absorb the whole card's text. Instead of the card title, names take in the badge, the quick-view button label, every price and the installment line, e.g.
Sale Feria Vista rápida Bermuda Duni Lino Marrón $120.900 $48.360 6 cuotas sin interés de $8.060 Precio sin impuestos nacionales: ….productNameText()falls through to "the first element carrying a name/title/product token". The first such element is a wrapper whose class containsproduct, such as the card custom element orproduct-card--featured-image, socollapsedText()returns the entire card. - Slugs drop accented letters. The
$slugclosure inruntimeDeclarationsFromFallbacks()replaces every non-[a-z0-9]byte, soPantalón Fausti Marrónbecomespantal-n-fausti-marr-ninstead ofpantalon-fausti-marron. (WordPress'ssanitize_title()removes accents first; for comparison, the source's own product URL is/products/pantalon-fausti-marron.)
Reduced card (neutral)
<ul class="grid">
<li class="columns"><product-card class="product-card">
<figure class="product-card--featured-image">
<span class="product-card--badges"><span class="badge">Sale</span></span>
<a href="/products/pantalon-fausti-marron" title="Pantalón Fausti Marrón"><img src="a.jpg" alt="Pantalón Fausti Marrón"></a>
<quick-view class="product-card-quickview" data-product-handle="pantalon-fausti-marron"><span>Vista rápida</span></quick-view>
</figure>
<div class="product-card-info">
<a href="/products/pantalon-fausti-marron" title="Pantalón Fausti Marrón" class="product-card-title">Pantalón Fausti Marrón</a>
<span class="price"><del><span class="amount"><span class="money">$120,900</span></span></del>
<ins><span class="amount"><span class="money">$48,360</span></span></ins></span>
<span class="cuotas"> · 6 cuotas sin interés de <span class="money">$8,060</span></span>
</div>
</product-card></li>
</ul>
Facet drawer on the same page:
<div class="side-panel facet-drawer" id="Facet-Drawer" inert="">
<div class="side-panel-header"><div>
<h4>FILTRAR <span class="filter-count"><span class="facets__label">0 productos</span></span></h4>
</div></div>
<div class="side-panel-content"><form><select name="sort_by">
<option value="price-ascending">Precio, menor a mayor</option>
</select></form></div>
<div class="side-panel-footer"><a href="/collections/x">Borrar</a><button class="button"><span>Aplicar</span></button></div>
</div>
Expected
- No product entity comes from a region with no currency-formatted price and no product link. A count such as "0 productos" is not a price.
- The product name is the card's own title: an
itemprop="name", a heading, or the most specific title or name element (for example the title link). It is never a wrapper that also contains the price, badge or controls. The reduced card yieldsPantalón Fausti Marrón, regular price120900, sale price48360. - Slugs transliterate accents (
pantalon-fausti-marron), matching WordPress slug behaviour. Where the card links to a product URL, prefer that URL's last path segment.
Regression fixture
A neutral fixture built from the reduced markup above that asserts the extracted products (name, slug, prices) and asserts that the facet drawer contributes none. It fails on trunk and passes with the fix, and the existing commerce fixture corpus stays green.
AI assistance
Investigated and drafted with Claude (Anthropic) via the Pi coding agent, which dumped the composed product declaration from a retained import run and traced the name and slug derivation in Blocks Engine source.
- Dominant language
- PHP
- Stars
- 22
- Forks
- 2
- Avg merge
- 8h 22m
- Merged PRs (30d)
- 659
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#2161 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/blocks-engine#2061 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#1701 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Automattic/blocks-engine#3183 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Sync EN] Document Error thrown by shm_* functions on a detached segment (#5975)Possibly taken A pull request linked to this issue is open or already merged. Opensync-en
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
新版升级一下对应的依赖可以么Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100