Version: 0.1
Author: ltan.dev
Requires: WordPress 5.8+, WooCommerce 6.0+, PHP 8.4+
License: GPL v3 or later
Custom WooCommerce extensions and payment gateway developed by ltan.dev. This plugin provides enhanced payment gateway functionality with configurable fees and custom messaging.
A flexible payment gateway based on WooCommerce BACS with enhanced features:
- Configurable Frontend Name - Customize the payment method name shown to customers
- Custom Success Message - Display a personalized message after successful order placement
- Customizable Instructions - Add payment instructions on thank you page and emails
- HPOS Compatible - Fully compatible with WooCommerce High-Performance Order Storage
- Extensible - Provides filters and actions for developers
A powerful fee management system that applies surcharges based on payment methods:
- Multiple Fees - Add unlimited conditional fees with different configurations
- Payment Method Restrictions - Apply fees only to specific payment gateways
- Fee Types:
- Fixed amount fees (e.g., $5.00)
- Percentage-based fees (e.g., 3.5%)
- Tax Support - Make fees taxable or non-taxable
- Smart Detection - Auto-applies fees when only one payment method is available
- Admin UI - Intuitive drag-and-drop interface for managing fees
- Enable/Disable - Toggle individual fees without deleting them
- Upload the
lt-wcfolder to the/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Go to WooCommerce > Settings > Payments
- Enable and configure "Custom Order Payment"
Navigate to WooCommerce > Settings > Payments > Custom Order Payment
- Enable/Disable - Toggle the payment gateway on/off
- Title - Payment method name shown on checkout
- Description - Brief description shown on checkout page
- Instructions - Detailed instructions for thank you page and emails
- Success Message - Custom message displayed after order completion
Navigate to WooCommerce > LT WC
Configure payment method-based fees that apply automatically at checkout:
- Click "+ Add Fee" button
- Configure the fee settings:
- Enabled - Toggle fee on/off
- Fee Name - Name displayed to customers (e.g., "Credit Card Processing Fee")
- Type - Choose Fixed or Percentage
- Amount - Enter the fee value
- Payment Methods - Select which payment methods trigger this fee (multi-select)
- Taxable - Whether the fee should include tax
- Drag & Drop - Reorder fees using the drag handle
- Remove - Delete fees with the Remove button
- Enable/Disable - Toggle individual fees without deleting them
- Credit Card Fee: 3.5% percentage fee for credit card gateways
- Bank Transfer Discount: -5.00 fixed fee (discount) for bank transfers
- Processing Fee: $2.50 fixed fee for all payment methods
// Triggered when plugin initializes
do_action( 'lt_wc_init' );// Modify gateway icon
apply_filters( 'lt_wc_custom_order_icon', string $icon_url );
// Modify default order status
apply_filters( 'lt_wc_custom_order_process_payment_order_status', string $status, WC_Order $order );
// Modify gateway availability
apply_filters( 'lt_wc_custom_order_is_available', bool $is_available, LT_WC_Gateway_Custom_Order $gateway );
// Modify conditional fees settings
apply_filters( 'woocommerce_get_settings_lt_wc', array $settings );
// Modify conditional fees data before saving
apply_filters( 'lt_wc_save_conditional_fees', array $fees );add_filter( 'lt_wc_custom_order_process_payment_order_status', function( $status, $order ) {
// Change to 'processing' instead of 'on-hold'
return 'processing';
}, 10, 2 );add_filter( 'lt_wc_custom_order_icon', function( $icon ) {
return get_stylesheet_directory_uri() . '/images/payment-icon.png';
} );add_filter( 'lt_wc_custom_order_is_available', function( $is_available, $gateway ) {
// Disable for orders over $1000
if ( WC()->cart && WC()->cart->get_total( 'raw' ) > 1000 ) {
return false;
}
return $is_available;
}, 10, 2 );// Add a fee based on custom conditions
add_action( 'woocommerce_cart_calculate_fees', function() {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return;
}
// Get chosen payment method
$payment_method = WC()->session->get( 'chosen_payment_method' );
// Add custom fee for specific gateway
if ( 'custom_gateway_id' === $payment_method ) {
WC()->cart->add_fee( __( 'Custom Fee', 'text-domain' ), 10.00, true );
}
} );lt-wc/
├── lt-wc.php # Main plugin file
├── includes/
│ ├── admin/
│ │ └── class-lt-wc-admin-settings.php # Admin settings page
│ ├── gateways/
│ │ └── class-lt-wc-gateway-custom-order.php # Custom Order Payment Gateway
│ └── class-lt-wc-conditional-fees.php # Conditional fees manager
├── languages/ # Translation files
└── README.md # Documentation
- Follows WordPress Coding Standards
- Compatible with PHPCS WordPress ruleset
- Security-first approach with proper escaping and sanitization
- HPOS compatible using WooCommerce CRUD methods
- Full i18n/l10n support
- ABSPATH guards on all PHP files
- Output escaping with
esc_html(),esc_attr(),esc_url() - Input sanitization with
sanitize_text_field(),wc_clean() - Capability checks for admin operations
- Nonce verification for form submissions
- Safe text fields for user-configurable content
- Initial release
- Custom Order Payment Gateway with configurable options
- Conditional Fees system with admin management UI
- Support for fixed and percentage-based fees
- Payment method-based fee restrictions
- Customizable success messages and instructions
- HPOS compatibility
- Developer hooks and filters
For support, feature requests, or bug reports, please contact ltan.dev
This plugin is licensed under GPL v3 or later.
Copyright (C) 2025 ltan.dev
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.