Skip to content

Prroffessorr/swoowishlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adaptation WooCommerce Wishlist + Telegram Notifications

A lightweight, secure, and highly scalable wishlist plugin for WooCommerce. Built with a focus on performance, clean architecture, and seamless Telegram integration for real-time business insights.

🚀 Key Features

  • Core Wishlist: AJAX-powered "Add to Wishlist" buttons and a fast grid-based wishlist view via the [my_wishlist] shortcode.
  • Asynchronous Notifications: Telegram alerts are processed in the background via WP-Cron (5 min interval) to ensure zero impact on site performance.
  • Queue System: Robust event queue with status tracking (Pending / Sent / Failed / Skipped).
  • Intelligent Deduplication: Prevents notification spam during AJAX race conditions using a 15-second time window per user/product/event.
  • Retry Engine: Automatic delivery attempts (up to 3 times) with detailed error logging in the admin panel.
  • Professional Admin UI: Full-featured event monitoring dashboard built on the native WP_List_Table class with a "Retry Now" row action.

🏗 Architecture & Design Patterns

  • Singleton Pattern: Ensures a single point of entry and state management for the entire plugin.
  • Strategy Pattern: The notification engine uses a Provider_Interface, making it easy to add new channels (Slack, Email, SMS) without changing core logic.
  • Decoupled Logger: The event capture logic is separated from the delivery logic. The system logs events immediately and processes them asynchronously.
  • Lifecycle Management: Environment checks (PHP version, WooCommerce dependency) are performed during activation to prevent system crashes.

🔄 Core Workflows

1. User Action & AJAX Flow

  1. Trigger: User clicks the "Add to Wishlist" button on a product page.
  2. Security: JavaScript retrieves a WP Nonce for CSRF protection.
  3. Validation: The server verifies authentication, the nonce, and the unique product ID.
  4. Data Persistence: Updates are stored in user_meta (key: _my_wishlist_products).
  5. Event Capture: The Event_Logger captures the interaction and pushes it to the custom database queue if it's not a duplicate.

2. Notification Queue Flow

  1. Cron Trigger: Every 5 minutes, the Wishlist_Worker is activated.
  2. Batch Processing: The worker fetches the oldest pending or failed (with attempts < 3) events.
  3. Provider Validation: Checks if the Telegram provider is active and if the specific event type is enabled in settings.
  4. Dispatch: Sends the payload to Telegram Bot API via wp_remote_post.
  5. Status Update: Updates the database with the result (success/failure) and increments the attempt counter.

🛠 Tech Stack

  • Backend: PHP 8.1+, WordPress Settings API, WP_List_Table.
  • Frontend: Vanilla-style jQuery, CSS3 Grid.
  • Integrations: Telegram Bot API (Secure HTML formatting).

📋 Installation & Setup

  1. Upload: Copy the adaptation-wishlist folder to your /wp-content/plugins/ directory.
  2. Activate: Go to 'Plugins' in WordPress Admin and activate "Adaptation WooCommerce Wishlist".
  3. Configure:
    • Navigate to Wishlist Notifications -> Settings (look for the Telegram icon in the sidebar).
    • Enter your Telegram Bot Token and Chat ID.
    • Select which events to track (Product Added / Product Removed).
  4. Shortcode: Create a new page and insert [my_wishlist] to display the user's wishlist.
  5. Monitoring: View all delivery statuses and errors in the Event Logs tab.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors