=== Smart Chat Button === Contributors: mrsoukbh Donate link: https://linkze.me/donate-me Tags: whatsapp, chat, woocommerce, sticky button, floating button Requires at least: 3.7 Tested up to: 6.8 Requires PHP: 7.2 Stable tag: 1.4.0 License: GNU General Public License v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Add a beautiful, customizable WhatsApp chat button to your WordPress or WooCommerce site to boost customer engagement instantly. == Description == **Smart Chat Button** is a fast, lightweight, and highly customizable WordPress plugin that displays a beautiful floating WhatsApp chat button on your website. After clicking the button, users are taken directly to WhatsApp Mobile App or WhatsApp Web, depending on their device. This plugin supports: - 📱 WhatsApp & WhatsApp Business integration - 💬 Prefilled message with dynamic variables (e.g., `{product_title}`) - 🎨 Custom icon upload - 🧊 Modern glassmorphic floating button with animation - 🗨️ Sliding chat drawer with custom text & colors - 🛠️ Modern, responsive admin settings panel - ♿ Accessible markup with keyboard support - 🌍 Fully translatable (WPML & Polylang compatible) - 🛒 WooCommerce integration – show button only on product pages - 📐 Responsive positioning (Bottom Left / Bottom Right) - 📏 Customizable margins per device type (Mobile, Tablet, Desktop) Perfect for e-commerce stores, service providers, and customer support teams looking to improve engagement through direct messaging. == Installation == = From Your WordPress Dashboard = 1. Navigate to Plugins → Add New 2. Search for "Smart Chat Button" 3. Click Install Now, then Activate 4. Go to Settings → Smart Chat Button to configure = Manual Upload via FTP = 1. Download the plugin ZIP file 2. Unzip and upload the `smart-chat-button` folder to `/wp-content/plugins/` 3. Activate the plugin from the Plugins menu in WordPress == Frequently Asked Questions == = How do I set my WhatsApp number? = Go to **Settings > Smart Chat Button** and enter your WhatsApp number **with country code**, but without any special characters like `+`, `-`, `(`, `)` or spaces. Example: ✅ Use: `15551234567` ❌ Don't use: `+1 (555) 123-4567` = Can I change the position of the button? = Yes! You can choose between **Bottom Left** or **Bottom Right** positions from the settings page. = How can I display the button only on WooCommerce product pages? = Enable the option **"Only Show on Product Pages (WooCommerce)"** in the settings. This will hide the button on all non-product pages. = Can I add a prefilled message? = Yes! Enter your desired text in the **Default Message** field. You can also use `{product_title}` as a variable when using WooCommerce integration. = Is this plugin translation ready? = Yes! The plugin uses standard WordPress internationalization functions (`__()` and `echo esc_html__()`), and comes with a `.pot` file inside the `languages` directory. You can easily translate it into any language using tools like Loco Translate or Poedit. = Does this plugin affect site speed? = No! It’s built with performance in mind. No external JavaScript libraries or unnecessary assets are loaded. Only a small inline CSS and script in footer. == Changelog == = 1.4.0 = Added Modernized chat member UI: Whole card is now clickable for improved user experience. Inline SVG loader function for safer and more flexible WhatsApp icon display. Improved fallback and sanitization logic for team member avatars. Per-member click stats now included on the Stats tab (admin). Changed Card visuals updated for a cleaner, flatter “material” look. WhatsApp icons are loaded as inline SVG or attachment image, with proper security checks. Improved compatibility with strict WordPress coding standards and security policies. date() replaced with gmdate() in all stats output for timezone safety. Fixed All known output escaping issues—now fully passes WP Codex security and Plugin Check. Fixed PHP warning for undefined members key in stats array. Fixed rare avatar display issues when no team member avatar set. Fixed cases where SVG icons would not display if loaded through secure functions. Button and drawer now reliably open/close on all supported browsers. Removed Deprecated per-row WhatsApp icon links in team member cards; now only main card is clickable. = 1.3.0 = ✨ New Features Team Members Support: Add and manage multiple WhatsApp agents via admin with names, roles, numbers, avatars, and enable/disable toggle. Modern Admin Design: Improved, flatter card-style admin settings UI with tabbed navigation and better responsive styles. Button Click Stats: New “Stats” tab in admin to view total and daily button click counts for the last 7 days. Custom Icon Upload: Set a custom WhatsApp icon from the Media Library or use the default SVG. Preview Updates: Live icon preview in the admin design settings. More Controls: Margin controls for mobile, tablet, desktop and per-device button visibility toggles. Role/Avatar Support: Team member role and avatar fields, with preview and easy upload. 🐞 Fixes & Improvements Fixed: Button and modal positioning now responds to left/right setting and margin controls. Fixed: Escaping and sanitization improvements for all dynamic output (PHPCS compliance). Fixed: Button/box, icon and team member UI now more accessible and consistent. Fixed: “Show only on WooCommerce product pages” logic. Fixed: Click tracking logic is now more robust. Fixed: SVGs and uploaded avatars are displayed securely and responsively. Fixed: Various CSS and responsive issues on settings and frontend. Fixed: Settings tabs navigation and state on reload. Improved: Codebase now follows WordPress coding standards and best security practices. 🚀 Upgrade Notes Please review your “Team Members” tab after updating, and re-save settings to ensure new data structures are initialized. If you use caching, clear after update to see frontend changes. = 1.2.0 = * Added Stats tab to view WhatsApp click counts * Counts are tracked via AJAX without reloading the page * Minor style and version updates = 1.1.0 = * Added media library icon selector and improved escaping * Redesigned admin settings panel with responsive layout * Added helper for secure image output * Fixed escaping issues flagged by Plugin Check * Versioned asset loading for better caching * Added Elementor widget for custom WhatsApp chat buttons * Added customizable sliding chat drawer * New glassmorphic floating button style * Color pickers and text fields in settings = 1.0.0 = * Initial release * Basic WhatsApp chat button functionality * Positioning options * Margin settings per device type == Screenshots == 1. screenshot-1.png - WhatsApp Button Settings (General) 2. screenshot-2.png - WhatsApp Button Settings (Position & Styling) 3. screenshot-3.png - WhatsApp Button with Floating Text Bubble (Bottom Left) 4. screenshot-4.png - WhatsApp Button without Text Bubble (Bottom Left) 5. screenshot-5.png - WhatsApp Button with Floating Text Bubble (Bottom Right) 6. screenshot-6.png - WhatsApp Button without Text Bubble (Bottom Right)