Commit ac893c1cf4 for woocommerce

commit ac893c1cf4877f2c4feca91fb1f687b8afa45712
Author: Néstor Soriano <konamiman@konamiman.com>
Date:   Wed Jan 21 11:10:23 2026 +0100

    Add missing relevant hooks info for products and currencies REST API endpoints caching (#62859)

diff --git a/plugins/woocommerce/changelog/pr-62859 b/plugins/woocommerce/changelog/pr-62859
new file mode 100644
index 0000000000..271aa5b3b9
--- /dev/null
+++ b/plugins/woocommerce/changelog/pr-62859
@@ -0,0 +1,4 @@
+Significance: minor
+Type: update
+
+Add missing relevant hooks info for products and currencies REST API endpoints caching
diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php
index b3ecfb77cb..5077e2857a 100644
--- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php
+++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php
@@ -53,6 +53,23 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr
 		return 'product_variation';
 	}

+	/**
+	 * Get the hooks relevant to response caching.
+	 *
+	 * @param WP_REST_Request<array<string, mixed>> $request     The request object.
+	 * @param string|null                           $endpoint_id Optional endpoint identifier.
+	 * @return array Array of hook names to track for cache invalidation.
+	 */
+	protected function get_hooks_relevant_to_caching( WP_REST_Request $request, ?string $endpoint_id = null ): array { // phpcs:ignore Squiz.Commenting.FunctionComment.IncorrectTypeHint
+		return array(
+			'woocommerce_rest_prepare_product_variation_object',
+			'woocommerce_product_type_query',
+			'woocommerce_product_class',
+			'woocommerce_short_description',
+			'woocommerce_rest_product_variation_object_query',
+		);
+	}
+
 	/**
 	 * Register the routes for products.
 	 */
diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
index c6beb25063..44fdca9920 100644
--- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
+++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
@@ -73,6 +73,23 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller {
 		return 'product';
 	}

+	/**
+	 * Get the hooks relevant to response caching.
+	 *
+	 * @param WP_REST_Request<array<string, mixed>> $request     The request object.
+	 * @param string|null                           $endpoint_id Optional endpoint identifier.
+	 * @return array Array of hook names to track for cache invalidation.
+	 */
+	protected function get_hooks_relevant_to_caching( WP_REST_Request $request, ?string $endpoint_id = null ): array { // phpcs:ignore Squiz.Commenting.FunctionComment.IncorrectTypeHint
+		return array(
+			'woocommerce_rest_prepare_product_object',
+			'woocommerce_product_type_query',
+			'woocommerce_product_class',
+			'woocommerce_short_description',
+			'woocommerce_rest_product_object_query',
+		);
+	}
+
 	/**
 	 * Get data for ETag generation, excluding fields that change on each request.
 	 *
diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php
index 46a9e25fb0..25ca054bc5 100644
--- a/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php
+++ b/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php
@@ -257,6 +257,20 @@ class WC_REST_Data_Currencies_Controller extends WC_REST_Data_Controller {
 		return array( 'i18n/currencies.php' );
 	}

+	/**
+	 * Get the hooks relevant to response caching.
+	 *
+	 * @param WP_REST_Request<array<string, mixed>> $request     The request object.
+	 * @param string|null                           $endpoint_id Optional endpoint identifier.
+	 * @return array Array of hook names to track for cache invalidation.
+	 */
+	protected function get_hooks_relevant_to_caching( WP_REST_Request $request, ?string $endpoint_id = null ): array { // phpcs:ignore Squiz.Commenting.FunctionComment.IncorrectTypeHint
+		return array(
+			'woocommerce_rest_prepare_data_currency',
+			'woocommerce_currencies',
+		);
+	}
+
 	/**
 	 * Whether the response cache should vary by user.
 	 *