Commit 7cd17c2bad3 for woocommerce
commit 7cd17c2bad385fc14a02424791b504f621963a76
Author: Vlad Olaru <vlad.olaru@automattic.com>
Date: Thu Jul 16 11:19:07 2026 +0300
Exclude infinite scrolling preference from customer metadata (#66697)
* fix: exclude infinite scrolling from customer metadata
WordPress 7.1 writes the infinite_scrolling preference to user meta for newly created users.
WooCommerce currently treats that WordPress-owned preference as custom customer metadata, exposing it through customer REST responses and breaking pre-release compatibility tests.
Classify the preference as internal and cover the boundary with a version-independent regression test that also verifies custom user meta remains available.
* chore: add customer metadata fix changelog
The customer metadata compatibility fix ships with the WooCommerce plugin and needs a package changelog entry.
Record it as a patch fix so release tooling can include the behavior change in the generated changelog.
diff --git a/plugins/woocommerce/changelog/fix-customer-infinite-scrolling-meta b/plugins/woocommerce/changelog/fix-customer-infinite-scrolling-meta
new file mode 100644
index 00000000000..52bc5c0159a
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-customer-infinite-scrolling-meta
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Prevent WordPress personal preferences from being exposed as customer metadata.
diff --git a/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php b/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php
index b1a120e0f9f..839ecfc7dca 100644
--- a/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php
+++ b/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php
@@ -67,6 +67,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
'wptests_capabilities',
'wptests_user_level',
'syntax_highlighting',
+ 'infinite_scrolling',
'_order_count',
'_money_spent',
'_last_order',
diff --git a/plugins/woocommerce/tests/php/includes/data-stores/class-wc-customer-data-store-test.php b/plugins/woocommerce/tests/php/includes/data-stores/class-wc-customer-data-store-test.php
index 0261cf4ca50..e01990ff9d9 100644
--- a/plugins/woocommerce/tests/php/includes/data-stores/class-wc-customer-data-store-test.php
+++ b/plugins/woocommerce/tests/php/includes/data-stores/class-wc-customer-data-store-test.php
@@ -61,6 +61,22 @@ class WC_Customer_Data_Store_CPT_Test extends WC_Unit_Test_Case {
$this->assertEquals( $username, $customer->get_username() );
}
+ /**
+ * @testdox WordPress personal preferences are excluded from customer meta data.
+ */
+ public function test_wordpress_personal_preferences_are_excluded_from_customer_meta_data(): void {
+ $customer = WC_Helper_Customer::create_customer();
+
+ update_user_meta( $customer->get_id(), 'infinite_scrolling', 'true' );
+ update_user_meta( $customer->get_id(), 'custom_preference', 'custom-value' );
+
+ $read_customer = new WC_Customer( $customer->get_id() );
+ $meta_keys = wp_list_pluck( $read_customer->get_meta_data(), 'key' );
+
+ $this->assertNotContains( 'infinite_scrolling', $meta_keys, 'WordPress personal preferences should not be exposed as customer meta data.' );
+ $this->assertContains( 'custom_preference', $meta_keys, 'Custom user meta should remain available as customer meta data.' );
+ }
+
/**
* @testdox A backslash in a customer address field survives a save/read round-trip.
*