%s

', esc_html__( 'AgentCart: WooCommerce API keys not found. Try deactivating and reactivating the plugin.', 'agentcart' ) ); } ); } } } /** * Add settings page under WooCommerce menu. */ public function add_menu_page() { add_submenu_page( 'woocommerce', 'AgentCart', 'AgentCart', 'manage_woocommerce', 'agentcart-settings', array( $this, 'render_page' ) ); } /** * Handle form submissions (connect / disconnect). */ public function handle_form_submission() { if ( ! isset( $_POST['agentcart_action'] ) ) { return; } if ( ! check_admin_referer( 'agentcart_settings', 'agentcart_nonce' ) ) { return; } if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } $action = sanitize_text_field( wp_unslash( $_POST['agentcart_action'] ) ); if ( $action === 'connect' ) { $code = isset( $_POST['agentcart_code'] ) ? sanitize_text_field( wp_unslash( $_POST['agentcart_code'] ) ) : ''; $result = AgentCart_Connect::pair( $code ); if ( is_wp_error( $result ) ) { add_settings_error( 'agentcart', 'pairing_error', $result->get_error_message(), 'error' ); } else { add_settings_error( 'agentcart', 'pairing_success', __( 'Successfully connected to AgentCart!', 'agentcart' ), 'success' ); } } if ( $action === 'disconnect' ) { AgentCart_Connect::disconnect(); add_settings_error( 'agentcart', 'disconnect_success', __( 'Disconnected from AgentCart.', 'agentcart' ), 'success' ); } } /** * Render the settings page. */ public function render_page() { $connected = AgentCart_Connect::is_connected(); $merchant_id = AgentCart_Connect::get_merchant_id(); $api_url = get_option( 'agentcart_api_url', 'https://app.agentcart.io' ); ?>

✓


  1. app.agentcart.io → Connect → WooCommerce' ); ?>
  2. ' . esc_html__( 'Connect', 'agentcart' ) . '' ); ?>

' . esc_html__( 'Sign up at agentcart.io', 'agentcart' ) . '' ); ?>