Menu Close

How to add checkout payment Fee for all payment gateways – WooCommerce


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 );

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


Posted in PHP, WooCommerce, WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *

You can also read...