WP Manifestindependent plugin directory
manifest / ecommerce / woocommerce-wallet-system

WooCommerce Simple Wallet System

A simple wallet payment system for WooCommerce

by Sarfaraz Kazi · github.com/sarfaraz-kazi/woocommerce-wallet-system

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/sarfaraz-kazi/woocommerce-wallet-system/archive/refs/heads/main.zip

Video Demonstrate:

https://go.screenpal.com/watch/cTQfQzno2tY

I've created a complete WooCommerce wallet system plugin that meets all your requirements. Here's what the plugin includes:

Features Implemented:

  1. Wallet Balance Storage: Each user has a meta field _wallet_balance to store their current wallet balance
  2. Payment Gateway: Wallet appears as a payment option during checkout
  3. Balance Validation: Only allows payment if wallet balance ≥ order total (no partial payments)
  4. Admin Interface: Wallet balance field added to user profile pages in WP Admin
  5. User Dashboard: Wallet balance displayed on customer account dashboard

Key Components:

Main Class (WC_Simple_Wallet_System)

  • Manages wallet balance operations
  • Handles user profile integration
  • Provides helper methods for balance management

Payment Gateway Class (WC_Wallet_Payment_Gateway)

  • Extends WooCommerce's payment gateway framework
  • Validates wallet balance before showing as available
  • Processes payments by deducting from wallet

Edge Cases Handled:

  1. Insufficient Balance: Gateway only appears if balance ≥ order total
  2. Non-logged Users: Wallet payment unavailable for guests
  3. Negative Balances: Prevents wallet balance from going below zero
  4. Invalid Users: Handles cases where user ID is invalid/empty
  5. Transaction Safety: Validates balance again during payment processing
  6. Currency Consistency: Uses store's default currency throughout

Installation Instructions:

  1. Upload plugin folder to /wp-content/plugins/ directory
  2. Activate the plugin through WordPress admin
  3. The plugin will automatically:
    • Add wallet balance (0.00) to all existing users
    • Set up the payment gateway
    • Add admin fields for balance management

Usage:

  1. Admin: Go to Users → Edit User → Wallet Information to set/update balances
  2. Customers: View balance on My Account dashboard
  3. Checkout: Wallet payment appears only when balance is sufficient

The code is clean, well-documented, and follows WordPress/WooCommerce coding standards. It includes proper sanitization, validation, and error handling throughout.