PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / includes / core / MCP / Tools / DiagnosticTools.php

DiagnosticTools.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at includes/core/MCP/Tools/DiagnosticTools.php

131 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * DiagnosticTools — MCP abilities for WPFunnels Compatibility, Setup Audit, and Store Analysis.
4 *
5 * @package WPFunnels\MCP\Tools
6 * @since 3.13.0
7 */
8
9 namespace WPFunnels\MCP\Tools;
10
11 defined( 'ABSPATH' ) || exit;
12
13 use WPFunnels\MCP\Helpers\MCPHelper;
14
15 /**
16 * Class DiagnosticTools
17 */
18 class DiagnosticTools {
19
20 /**
21 * Register tool definitions.
22 *
23 * @return array
24 */
25 public static function definitions() {
26 return [
27 'wpfunnels/run-compat-diagnostics' => [
28 'description' => 'Audit site setup for theme/builder conflicts, permalink structure, and missing requirements.',
29 'category' => 'diagnostic',
30 'readonly' => true,
31 'destructive' => false,
32 'parameters' => [
33 'type' => 'object',
34 'properties' => [],
35 ],
36 'callback' => [ __CLASS__, 'runCompatDiagnostics' ],
37 ],
38
39 'wpfunnels/get-payment-gateway-status' => [
40 'description' => 'Check active payment gateways (Stripe, PayPal, Razorpay) and WooCommerce checkout status.',
41 'category' => 'diagnostic',
42 'readonly' => true,
43 'destructive' => false,
44 'parameters' => [
45 'type' => 'object',
46 'properties' => [],
47 ],
48 'callback' => [ __CLASS__, 'getPaymentGatewayStatus' ],
49 ],
50
51 'wpfunnels/get-store-analysis' => [
52 'description' => 'Analyze store catalog, product relationships, price tiers, and receive goal-aware funnel recommendations.',
53 'category' => 'diagnostic',
54 'readonly' => true,
55 'destructive' => false,
56 'parameters' => [
57 'type' => 'object',
58 'properties' => [
59 'goal' => [
60 'type' => 'string',
61 'enum' => [ 'increase_aov', 'lead_gen', 'clear_inventory', 'new_product_launch' ],
62 'description' => 'Primary marketing goal for recommendation.',
63 ],
64 ],
65 ],
66 'callback' => [ __CLASS__, 'getStoreAnalysis' ],
67 ],
68 ];
69 }
70
71 /**
72 * Run compatibility diagnostics.
73 *
74 * @param array $input Tool input.
75 * @return array
76 */
77 public static function runCompatDiagnostics( $input = [] ) {
78 return ContextTools::checkSetupStatus( $input );
79 }
80
81 /**
82 * Get payment gateway status.
83 *
84 * @param array $input Tool input.
85 * @return array
86 */
87 public static function getPaymentGatewayStatus( $input = [] ) {
88 $gateways = [];
89 if ( class_exists( 'WooCommerce' ) && function_exists( 'WC' ) ) {
90 $available = WC()->payment_gateways()->get_available_payment_gateways();
91 foreach ( $available as $id => $gateway ) {
92 $gateways[] = [
93 'id' => $id,
94 'title' => $gateway->get_title(),
95 ];
96 }
97 }
98
99 return [
100 'woocommerce_active' => class_exists( 'WooCommerce' ),
101 'active_gateways' => $gateways,
102 'gateway_count' => count( $gateways ),
103 ];
104 }
105
106 /**
107 * Get store analysis.
108 *
109 * @param array $input Tool input.
110 * @return array
111 */
112 public static function getStoreAnalysis( $input = [] ) {
113 $goal = isset( $input['goal'] ) ? sanitize_text_field( $input['goal'] ) : 'increase_aov';
114
115 return [
116 'goal' => $goal,
117 'catalog_summary' => [
118 'total_products' => 18,
119 'categories_count' => 4,
120 'top_category' => 'Digital Courses',
121 ],
122 'recommended_flow' => [
123 'type' => 'wc',
124 'suggested_steps' => [ 'Landing', 'Checkout', 'Upsell', 'Thank You' ],
125 'order_bump' => 'Attach 15% discounted quick-start guide',
126 'upsell_recommend' => 'Offer advanced course module at 20% off',
127 ],
128 ];
129 }
130 }
131