Commit 787740262c for woocommerce
commit 787740262c861ff1213eab393fd25565dd7b708f
Author: Brian <brian@brianhaas.li>
Date: Wed Feb 4 21:52:37 2026 +0100
Schema 'offerCount' property should only consider 'valid' offers (#61649)
diff --git a/plugins/woocommerce/changelog/61649-patch-6 b/plugins/woocommerce/changelog/61649-patch-6
new file mode 100644
index 0000000000..278a149b2b
--- /dev/null
+++ b/plugins/woocommerce/changelog/61649-patch-6
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Updated offerCount product schema value to only count purchasable product variations, excluding those without price or stock.
\ No newline at end of file
diff --git a/plugins/woocommerce/includes/class-wc-structured-data.php b/plugins/woocommerce/includes/class-wc-structured-data.php
index e47d928f70..923f6c57c7 100644
--- a/plugins/woocommerce/includes/class-wc-structured-data.php
+++ b/plugins/woocommerce/includes/class-wc-structured-data.php
@@ -255,7 +255,7 @@ class WC_Structured_Data {
'@type' => 'AggregateOffer',
'lowPrice' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
'highPrice' => wc_format_decimal( $highest, wc_get_price_decimals() ),
- 'offerCount' => count( $product->get_children() ),
+ 'offerCount' => count( $product->get_variation_prices()['price'] ),
);
if ( $product->is_on_sale() ) {
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index 70649c5ee6..af0392b43c 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -19173,7 +19173,7 @@ parameters:
-
message: '#^Call to an undefined method WC_Product\:\:get_variation_prices\(\)\.$#'
identifier: method.notFound
- count: 1
+ count: 2
path: includes/class-wc-structured-data.php
-