Commit a04a60ccd2 for woocommerce

commit a04a60ccd2441fd15c887381b665b0f48c198226
Author: Anand Rajaram <anandrajaram21@gmail.com>
Date:   Mon Feb 16 20:14:58 2026 +0530

    Updating stock from dashboard retains product type and variations (#63250)

    * feat: fix product type to return correct type instead of just simple

    * Add changefile(s) from automation for the following project(s): woocommerce

    * feat: apply suggested minor style change

    * feat: update phpstan baseline

    * feat: fix lint issue

    ---------

    Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>

diff --git a/plugins/woocommerce/changelog/63250-63057-variable-product-update b/plugins/woocommerce/changelog/63250-63057-variable-product-update
new file mode 100644
index 0000000000..2fbd34880c
--- /dev/null
+++ b/plugins/woocommerce/changelog/63250-63057-variable-product-update
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fixes a bug where updating the stock count from the dashboard for a variable product changed its product type back to a simple product and removed all variations.
\ No newline at end of file
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index e516dfaf8b..41798a70d2 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -41301,12 +41301,6 @@ parameters:
 			count: 1
 			path: src/Admin/API/ProductsLowInStock.php

-		-
-			message: '#^Access to an undefined property object\:\:\$post_type\.$#'
-			identifier: property.notFound
-			count: 1
-			path: src/Admin/API/ProductsLowInStock.php
-
 		-
 			message: '#^Access to an undefined property object\:\:\$stock_quantity\.$#'
 			identifier: property.notFound
diff --git a/plugins/woocommerce/src/Admin/API/ProductsLowInStock.php b/plugins/woocommerce/src/Admin/API/ProductsLowInStock.php
index 8d39bb40ca..0b675b3e2d 100644
--- a/plugins/woocommerce/src/Admin/API/ProductsLowInStock.php
+++ b/plugins/woocommerce/src/Admin/API/ProductsLowInStock.php
@@ -290,8 +290,11 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
 			$query_result->last_order_date = null;
 		}

+		$product_id   = (int) $query_result->ID;
+		$product_type = \WC_Product_Factory::get_product_type( $product_id );
+
 		return array(
-			'id'               => (int) $query_result->ID,
+			'id'               => $product_id,
 			'images'           => $query_result->images,
 			'attributes'       => $query_result->attributes,
 			'low_stock_amount' => $low_stock_amount,
@@ -299,7 +302,7 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
 			'name'             => $query_result->post_title,
 			'parent_id'        => (int) $query_result->post_parent,
 			'stock_quantity'   => (int) $query_result->stock_quantity,
-			'type'             => 'product_variation' === $query_result->post_type ? ProductType::VARIATION : ProductType::SIMPLE,
+			'type'             => $product_type ? $product_type : ProductType::SIMPLE,
 		);
 	}