Treat platform express-checkout buttons in a bound add-to-cart form as an evidenced removal, not content loss

未关闭
#6,499 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
backend

调研方向

Start by reading the #6492 changes and the existing accepted-removal path in SourceContentConservationReporter, then trace how commerce_add_to_cart_form is bound. Add or update fixtures for the nested Shopify payment widget and for the same widget outside a bound form. Done means the bound case emits one info removal record and no html_content_dropped finding, while the unbound case still reports content loss and the #6492 cases pass.

由索引模型根据 Issue 内容生成。

描述

Summary

Since #6492, source text dropped before emitted blocks is reported as html_content_dropped and counts toward content_loss_count. On commerce storefronts, one drop recurs on every product page: the platform's dynamic-checkout / express-payment button. Conversion drops it on purpose, because the target store provides its own checkout. With no evidence attached, though, it counts as content loss and fails the import gate.

Evidence (real Shopify storefront, Dawn-family theme)

On an otherwise intact product page, #6492 reports one finding. The selector is … > product-form > form > div, with lost run ["Comprar ahora"] ("Buy it now"). The source:

<div class="product-form__buttons">
  <button type="submit" name="add">Add to cart</button>
  <div data-shopify="payment-button" class="shopify-payment-button">
    <shopify-accelerated-checkout …>
      <shopify-buy-it-now-button access-token="…" page-type="product" slot="button">
        <button type="button" class="shopify-payment-button__button shopify-payment-button__button--unbranded">Buy it now</button>
      </shopify-buy-it-now-button>
    </shopify-accelerated-checkout>
  </div>
</div>

The add-to-cart form itself converts and binds (commerce_add_to_cart_form). Only the platform payment widget is gone.

Proposal

When the add-to-cart form binds, treat a platform express-checkout widget nested in it as an evidenced removal, not silent loss:

  • Recognise it from structural or platform evidence: a known payment custom element (shopify-buy-it-now-button, shopify-accelerated-checkout, or the data-shopify="payment-button" host), or a non-submit type="button" sibling of the bound submit inside a payment-button host. Don't match on the button's text.
  • Emit an info-level commerce_platform_checkout_removed record (selector, platform, lost text) through the existing accepted-removal path in SourceContentConservationReporter.
  • It must not count toward content_loss_count.
  • If the enclosing form does not bind, keep reporting the drop as content loss.

Acceptance

  • A neutral fixture shaped like the snippet above yields 0 html_content_dropped findings and 1 info removal record, with the bound form unchanged.
  • The same widget outside a bound commerce form still yields html_content_dropped.
  • The existing #6492 negatives and positives stay green.

AI assistance: drafted by an AI agent (Claude) under operator direction.

主要语言
PHP
星标
28
派生
5
平均合并
2 小时 53 分钟
30 天内合并 PR
938

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Automattic/blocks-engine 的其他 Issue

查看 Automattic/blocks-engine 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。