Commit 98a889ee3b for woocommerce

commit 98a889ee3bbe12bdf486844140e059bbb4b8c598
Author: Sam Seay <samueljseay@gmail.com>
Date:   Sun Feb 22 21:55:31 2026 +1300

    Add weight and dimensions to Store API ProductSchema (#63334)

diff --git a/plugins/woocommerce/changelog/63334-add-weight-dimensions-to-store-api b/plugins/woocommerce/changelog/63334-add-weight-dimensions-to-store-api
new file mode 100644
index 0000000000..6fb92a3240
--- /dev/null
+++ b/plugins/woocommerce/changelog/63334-add-weight-dimensions-to-store-api
@@ -0,0 +1,4 @@
+Significance: minor
+Type: update
+
+Add weight and dimensions to Store API ProductSchema / Products endpoint.
\ No newline at end of file
diff --git a/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductSchema.php b/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductSchema.php
index 6882bdd012..7160a1668a 100644
--- a/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductSchema.php
+++ b/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductSchema.php
@@ -463,6 +463,54 @@ class ProductSchema extends AbstractSchema {
 				'context'     => [ 'view', 'edit', 'embed' ],
 				'readonly'    => true,
 			],
+			'weight'              => [
+				'description' => sprintf(
+					/* translators: %s: weight unit */
+					__( 'Product weight (%s).', 'woocommerce' ),
+					get_option( 'woocommerce_weight_unit' )
+				),
+				'type'        => 'string',
+				'context'     => [ 'view', 'edit' ],
+				'readonly'    => true,
+			],
+			'dimensions'          => [
+				'description' => __( 'Product dimensions.', 'woocommerce' ),
+				'type'        => 'object',
+				'context'     => [ 'view', 'edit' ],
+				'readonly'    => true,
+				'properties'  => [
+					'length' => [
+						'description' => sprintf(
+							/* translators: %s: dimension unit */
+							__( 'Product length (%s).', 'woocommerce' ),
+							get_option( 'woocommerce_dimension_unit' )
+						),
+						'type'        => 'string',
+						'context'     => [ 'view', 'edit' ],
+						'readonly'    => true,
+					],
+					'width'  => [
+						'description' => sprintf(
+							/* translators: %s: dimension unit */
+							__( 'Product width (%s).', 'woocommerce' ),
+							get_option( 'woocommerce_dimension_unit' )
+						),
+						'type'        => 'string',
+						'context'     => [ 'view', 'edit' ],
+						'readonly'    => true,
+					],
+					'height' => [
+						'description' => sprintf(
+							/* translators: %s: dimension unit */
+							__( 'Product height (%s).', 'woocommerce' ),
+							get_option( 'woocommerce_dimension_unit' )
+						),
+						'type'        => 'string',
+						'context'     => [ 'view', 'edit' ],
+						'readonly'    => true,
+					],
+				],
+			],
 			'add_to_cart'         => [
 				'description' => __( 'Add to cart button parameters.', 'woocommerce' ),
 				'type'        => 'object',
@@ -559,6 +607,12 @@ class ProductSchema extends AbstractSchema {
 				'class' => $availability['class'] ?? '',
 			),
 			'sold_individually'   => $product->is_sold_individually(),
+			'weight'              => $product->get_weight(),
+			'dimensions'          => (object) [
+				'length' => $product->get_length(),
+				'width'  => $product->get_width(),
+				'height' => $product->get_height(),
+			],
 			'add_to_cart'         => (object) array_merge(
 				[
 					'text'        => $this->prepare_html_response( $product->add_to_cart_text() ),
diff --git a/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/Products.php b/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/Products.php
index a47f9c8ccc..d604d3e6a1 100644
--- a/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/Products.php
+++ b/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/Products.php
@@ -29,6 +29,10 @@ class Products extends ControllerTestCase {
 					'name'              => 'Test Product 1',
 					'stock_status'      => ProductStockStatus::IN_STOCK,
 					'regular_price'     => 10,
+					'weight'            => '2.5',
+					'length'            => '10',
+					'width'             => '5',
+					'height'            => '3',
 					'image_id'          => $fixtures->sideload_image(),
 					'gallery_image_ids' => array(),
 				)
@@ -68,6 +72,10 @@ class Products extends ControllerTestCase {
 		$this->assertEquals( $this->products[0]->add_to_cart_description(), $data['add_to_cart']->description );
 		$this->assertEquals( $this->products[0]->single_add_to_cart_text(), $data['add_to_cart']->single_text );
 		$this->assertEquals( $this->products[0]->is_on_sale(), $data['on_sale'] );
+		$this->assertEquals( $this->products[0]->get_weight(), $data['weight'] );
+		$this->assertEquals( $this->products[0]->get_length(), $data['dimensions']->length );
+		$this->assertEquals( $this->products[0]->get_width(), $data['dimensions']->width );
+		$this->assertEquals( $this->products[0]->get_height(), $data['dimensions']->height );
 		$this->assertCount( 0, $data['grouped_products'] );

 		$this->assertCount( 1, $data['images'] );
@@ -121,6 +129,8 @@ class Products extends ControllerTestCase {
 		$this->assertArrayHasKey( 'has_options', $data[0] );
 		$this->assertArrayHasKey( 'is_purchasable', $data[0] );
 		$this->assertArrayHasKey( 'is_in_stock', $data[0] );
+		$this->assertArrayHasKey( 'weight', $data[0] );
+		$this->assertArrayHasKey( 'dimensions', $data[0] );
 		$this->assertArrayHasKey( 'add_to_cart', $data[0] );
 		$this->assertArrayHasKey( 'extensions', $data[0] );
 	}
@@ -170,6 +180,8 @@ class Products extends ControllerTestCase {
 		$this->assertArrayHasKey( 'has_options', $data );
 		$this->assertArrayHasKey( 'is_purchasable', $data );
 		$this->assertArrayHasKey( 'is_in_stock', $data );
+		$this->assertArrayHasKey( 'weight', $data );
+		$this->assertArrayHasKey( 'dimensions', $data );
 		$this->assertArrayHasKey( 'add_to_cart', $data );
 	}