is_visible(); } /** * Execute the action. * * @param int $product_id WooCommerce product ID. * @param array $params Additional parameters from request. * @return array Execution result. */ public function execute(int $product_id, array $params = []): array { $product = wc_get_product($product_id); if (!$product) { return [ 'success' => false, 'message' => __('Product not found.', 'ai-product-tools'), ]; } if (!$product->is_visible()) { return [ 'success' => false, 'message' => __('Product not found.', 'ai-product-tools'), ]; } return [ 'success' => true, 'data' => [ 'action' => 'redirect', 'url' => $product->get_permalink(), ], ]; } /** * Get action priority for ordering. * * @return int Priority value. */ public function getPriority(): int { return 10; } }