Commit 885177fecd3 for woocommerce
commit 885177fecd3a3727badb9c4671d8fb3f0ac64ef0
Author: Tung Du <dinhtungdu@gmail.com>
Date: Tue Apr 14 15:32:44 2026 +0700
Follow-up to #63895: Remove duplicate changelog and add meta_data test coverage (#64136)
diff --git a/plugins/woocommerce/changelog/63895-woo6-38-codex-review-v4-product-endpoint-now-exposes-sensitive-data b/plugins/woocommerce/changelog/63895-woo6-38-codex-review-v4-product-endpoint-now-exposes-sensitive-data
deleted file mode 100644
index 97f07ab8508..00000000000
--- a/plugins/woocommerce/changelog/63895-woo6-38-codex-review-v4-product-endpoint-now-exposes-sensitive-data
+++ /dev/null
@@ -1,4 +0,0 @@
-Significance: patch
-Type: fix
-
-Strip sensitive fields (downloads, COGS, purchase note) from V4 products REST API response for users without product management capabilities.
\ No newline at end of file
diff --git a/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Products/ProductsControllerTest.php b/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Products/ProductsControllerTest.php
index 9be486ee79a..f339e591f8b 100644
--- a/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Products/ProductsControllerTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Products/ProductsControllerTest.php
@@ -2147,6 +2147,7 @@ class ProductsControllerTest extends WC_REST_Unit_Test_Case {
)
);
$product->set_downloads( array( $download ) );
+ $product->add_meta_data( 'secret_key', 'secret_value', true );
$product->save();
$author = $this->factory->user->create(
@@ -2164,6 +2165,7 @@ class ProductsControllerTest extends WC_REST_Unit_Test_Case {
$this->assertArrayNotHasKey( 'download_limit', $data, 'Author should not see download limit' );
$this->assertArrayNotHasKey( 'download_expiry', $data, 'Author should not see download expiry' );
$this->assertArrayNotHasKey( 'purchase_note', $data, 'Author should not see purchase note' );
+ $this->assertArrayNotHasKey( 'meta_data', $data, 'Author should not see meta data' );
}
/**
@@ -2219,6 +2221,7 @@ class ProductsControllerTest extends WC_REST_Unit_Test_Case {
);
$product->set_downloads( array( $download ) );
$product->set_cogs_value( 5.00 );
+ $product->add_meta_data( 'secret_key', 'secret_value', true );
$product->save();
$shop_manager = $this->factory->user->create(
@@ -2237,5 +2240,6 @@ class ProductsControllerTest extends WC_REST_Unit_Test_Case {
$this->assertArrayHasKey( 'download_expiry', $data, 'Shop manager should see download expiry' );
$this->assertArrayHasKey( 'purchase_note', $data, 'Shop manager should see purchase note' );
$this->assertArrayHasKey( 'cost_of_goods_sold', $data, 'Shop manager should see COGS data' );
+ $this->assertArrayHasKey( 'meta_data', $data, 'Shop manager should see meta data' );
}
}