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.zipVideo 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:
- Wallet Balance Storage: Each user has a meta field
_wallet_balanceto store their current wallet balance - Payment Gateway: Wallet appears as a payment option during checkout
- Balance Validation: Only allows payment if wallet balance ≥ order total (no partial payments)
- Admin Interface: Wallet balance field added to user profile pages in WP Admin
- 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:
- Insufficient Balance: Gateway only appears if balance ≥ order total
- Non-logged Users: Wallet payment unavailable for guests
- Negative Balances: Prevents wallet balance from going below zero
- Invalid Users: Handles cases where user ID is invalid/empty
- Transaction Safety: Validates balance again during payment processing
- Currency Consistency: Uses store's default currency throughout
Installation Instructions:
- Upload plugin folder to
/wp-content/plugins/directory - Activate the plugin through WordPress admin
- 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:
- Admin: Go to Users → Edit User → Wallet Information to set/update balances
- Customers: View balance on My Account dashboard
- 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.