Automattic\WooCommerce\Admin\API\AI

StoreInfo::get_response()publicWC 1.0

Update the store title powered by AI.

Method of the class: StoreInfo{}

No Hooks.

Return

WP_Error|WP_REST_Response.

Usage

$StoreInfo = new StoreInfo();
$StoreInfo->get_response();

StoreInfo::get_response() code WC 9.4.2

public function get_response() {
	$product_updater = new UpdateProducts();
	$patterns        = PatternsHelper::get_patterns_ai_data_post();

	$products = $product_updater->fetch_product_ids( 'dummy' );

	if ( empty( $products ) && ! isset( $patterns ) ) {
		return rest_ensure_response(
			array(
				'is_ai_generated' => false,
			)
		);
	}

	return rest_ensure_response(
		array(
			'is_ai_generated' => true,
		)
	);
}