PHP snippet to add a extra fee to the checkout for every payment gateway.
You can copied and pasted in your theme’s functions.php file and get solution for this.
PHP Code
/**
* @snippet How to add checkout payment Fee for a payment gateway - WooCommerce
*/
add_action( 'woocommerce_cart_calculate_fees', 'mycode_add_checkout_fee' );
function mycode_add_checkout_fee() {
// Edit "Payment Fee" and "3" below to control Label and Amount
WC()->cart->add_fee( 'Payment Fee', 3 );
}
Popular Posts
- Show / Hide div based on dropdown selected using jQuery
- Autosuggestion Select Box using HTML5 Datalist, PHP and MySQL with Example
- Custom Authentication Login And Registration Using Laravel 8
- Infinite Scrolling on PHP website using jQuery and Ajax with example
- Google Login or Sign In with Angular Application
- How to Convert MySQL Data to JSON using PHP
- How to change date format in PHP?
- Image Lazy loading Using Slick Slider
- Slick Slider Basic With Example
- php in_array check for multiple values
- Adaptive Height In Slick Slider
- Slick Slider Center Mode With Example
Total Views: 1,595