WooCommerce payment gateway based fees and discounts

WooCommerce payment gateway based fees and discounts for WooCommerce are an excellent way of incentivising or discouraging users from choosing certain methods of payment. They’re also an important way for you to ensure you don’t lose out through charges imposed by certain payment gateways. Stick around as we explore the multifaceted benefits of tailoring fees and discounts to specific WooCommerce payment gateways.

Payment gateway based fees and discounts for WooCommerce

In this article, I’m going to look at two ways to apply WooCommerce payment gateway based fees and discounts for WooCommerce:

  • Use a plugin to apply fees and discounts in WooCommerce according to the payment gateway
  • Programmatically apply fees and discounts according to the payment gateway

By the way, if you’re looking specifically for adding a cash on delivery fee, take a look at this article.

What is a WooCommerce payment gateway?

The payment gateway is the method used by the customer to pay for their order. Examples are PayPal, Stripe (for credit card payments), bank transfer, cash on delivery, and many more.

What payment gateways work with WooCommerce?

Some of the most popular payment gateways that work with WooCommerce are:

The full list of WooCommerce payment gateways is available on WooCommerce’s Extension Store, and you’ll be able to filter these by price. The majority of payment gateways are free to download though some require monthly payments.

Which payment gateway should I choose?

Which payment gateway you choose is going to be down to a number of factors, including:

  • Where you’re based – Not all payment gateways are available in every country
  • How much you’re prepared to pay in fees – each gateway has a different fee structure
  • How much you want to spend on initial costs – Some payment gateway plugins are free, others will cost you just to install them on your site

Ultimately, finding the perfect payment gateway hinges on carefully weighing these factors to ensure seamless transactions and optimal financial efficiency for your online business.

What do WooCommerce payment gateways cost?

Costs vary. For instance, PayPal can charge you up to 3.4% per transaction. That’s a big chunk of your profits.

On the other hand, if you offer BACS payments, Cash on Delivery, or other local pickup or collection options, you may not have any cost associated with the payment gateway.

This is the main reason you might want to levy a WooCommerce payment gateway based fee or discount – either to add a surcharge on the payment gateways that cost you extra. Or to offer a discount to customers if they use a cheaper payment method.

Not all payment gateways have costs attached

A really simple way of saving costs for yourself, as the business owner, and for your customers is to offer a collection option. Of course, this depends on the nature of your business but it works really well for stores that sell locally.

You can also offer bank transfer or cheque options. This increases the amount of manual work you need to do, and it slows down the overall process – but it does allow you to save some money.

Why use multiple gateways?

You might be thinking that it would just be simpler to only offer the cheapest payment gateways. Up to a point, that might be true. But there’s a good chance that you’ll miss out on sales if you don’t offer customers payment options that they’re familiar with.

For instance, although it’s expensive, PayPal is a really convenient option for many people to use for payment. They don’t need to find their credit card, they only need to click a button.

So having choice on your site can be to your benefit.

Why apply different charges according to the payment gateway used?

There are several reasons to apply different charges based on the payment gateway, including:

  • Credit card providers usually charge you a percentage of each transaction. You can recoup this fee by adding the equivalent amount to the cost of the order and therefore passing the transactional fees from your bank on to your customer.
  • PayPal charges you a fee on every transaction. You can add a flat fee or a percentage of the overall order total to recover this cost from the user.
  • With PayPal and credit card gateways, you can often find that you are subject to disputes or chargebacks. The costs for these vary between gateway providers but by adding a small surcharge to users who check out through one of these gateways, you can provide a small insurance for yourself against future disputes.
  • If you accept payment via BACS or bank transfer, you might be charged per transaction by your bank. You can add a small fixed fee to the cart to cover these bank charges.
  • You can offer incentives to your customers to pay by your preferred payment gateway by applying a discount. For instance, if you would like to encourage users to pay via bank transfer, you can offer a fixed or percentage discount.

Which is better – fee or discount?

Should you cost your products at a lower price, then add an extra fee for certain payment gateways? Or should you build the fees into your product price, then offer a discount if the customer chooses a less expensive payment gateway?

This will depend on the type of business you’re running:

  • Pricing products lower is always a good encouragement for customers; but seeing an extra fee imposed at checkout can be a cause of cart abandonment
  • Having slightly more expensive products but a discount at checkout could be a pleasant surprise for customers

Using a WooCommerce plugin to apply fees and discounts based on payment gateway

However you decide to approach WooCommerce payment gateway based fees and discounts, you’ll need an extension to WooCommerce.

The WooCommerce payment gateway fees plugin that I’m using is WooCommerce Fees and Discounts.

WooCommerce Fees and Discounts

Create powerful pricing incentives quickly and easily

Find Out More

I’m going to provide a couple of different examples using this WooCommerce plugin to show how to apply fees and discounts, either as fixed amounts or percentages of the overall total.

Install WooCommerce Fees and Discounts

  • Once you’ve downloaded the Fees and Discounts plugin, upload it to your WordPress admin via Plugins > Add New > Upload.
  • Activate the plugin then go to WooCommerce > Settings > Fees and Discounts.
  • Ensure that the ‘Enable Payment Gateway Fees and Discounts’ option is selected. You should see all the active payment gateways on your site available as clickable links below the main tabs.
WooCommerce payment gateways

You can set fees and discounts for each payment gateway separately.

How to add a fee to PayPal in WooCommerce

In this example, I’ll walk through charge to add a fixed fee to customers who check out via PayPal. But you can easily adapt this method to add a fee to any payment method.

  • Click on the PayPal Checkout link
  • In ‘Label’ enter the text that you’d like to use to denote the extra charge
  • Choose ‘Fixed fee’ in the ‘Type’ dropdown
  • Enter the amount of the fixed fee in the ‘Amount’ field
  • Decide whether to include shipping costs in the cart total. (Note that this is mainly relevant if you’re charging a percentage rather than a fixed fee and/or if you are setting minimum or maximum values for the cart)
  • In ‘Minimum cart amount’, you can enter a minimum total for the cart before any charges are applied.
  • For ‘Maximum cart amount’, you can enter a maximum total for the cart above which no charges will be applied.
  • Check ‘Apply tax’ if you would like tax to be applied to the extra charge
  • Select the ‘Tax class’
  • Click ‘Save changes’
WooCommerce add fee to PayPal

When you choose ‘PayPal’ at the checkout, you’ll see an additional fee added to the totals:

WooCommerce additional fee for PayPal

How to apply a discount for certain payment gateways in WooCommerce

In this example, I’ll walk through applying a discount for customers who choose to pay via direct bank transfer. For the sake of the example, the discount will be calculated as a percentage of the overall order total.

  • Click on the ‘Direct bank transfer’ link
  • In ‘Label’ enter the text that you’d like to use to describe the discount
  • Choose ‘Percentage discount’ in the ‘Type’ dropdown
  • Enter the percentage in the ‘Amount’ field. In this example, we’ll give the customer a 1% discount for checking out via direct bank transfer.
  • Decide whether to include shipping costs in the cart total.
  • In ‘Minimum cart amount’, you can enter a minimum total for the cart before any charges are applied. In this example, we’ve set a minimum of 75 – meaning that the customer will need to spend 75 of whatever currency being used before they qualify for the discount
  • For ‘Maximum cart amount’, you can enter a maximum total for the cart above which no charges will be applied.
  • In ‘Minimum fee/discount amount’, you can enter a minimum value for the discount
  • For ‘Maximum fee/discount amount’, you can set a maximum value for the discount. In this example, we’ve limited the discount to 5
  • Check ‘Apply tax’ if you would like tax to be applied to the extra charge
  • Select the ‘Tax class’
  • Click ‘Save changes’
WooCommerce payment gateway discount

Now, when the user adds at least $75 worth of goods to the cart, they’ll qualify for 1% discount to a maximum of $5.

WooCommerce percentage based discount at checkout

Programmatically apply fees and discounts in WooCommerce according to the payment gateway

If you prefer to create your own solution, here is some code to help with applying a fee at checkout based on payment gateway.

* Add a fee when the user checks out with PayPal
function wcfad_apply_payment_gateway_fee() {
$payment_method = WC()->session->get( 'chosen_payment_method' );
// Only apply the fee if the payment gateway is PayPal
// Note that you might need to check this slug, depending on the PayPal gateway you're using
if( $payment_method == 'ppec_paypal' ) {
$label = __( 'PayPal fee', 'wcfad' );
$amount = 5; // Change this value to whatever amount you wish
// Change the third parameter to false if you don't wish to apply tax to the fee
// Change the fourth parameter to a different tax class if required
WC()->cart->add_fee( $label, $amount, true, 'standard' );
add_action( 'woocommerce_cart_calculate_fees', 'wcfad_apply_payment_gateway_fee' );
* Add some JS
function wcfad_script() {
$('body').on('change','.checkout .input-radio',function(){
add_action( 'woocommerce_after_checkout_form', 'wcfad_script' );

This function gets the selected payment gateway for the user’s session and checks to see if it’s PayPal. Note that I’m using the ‘PayPal Checkout’ gateway rather than the older, standard ‘PayPal’ checkout.

If the user has selected the payment gateway, use WC()->cart->add_fee to add the fee. There are four parameters: label, amount, is_taxable, tax_class.

Finally, the function is hooked to woocommerce_cart_calculate_fees so it runs whenever the cart calculates fees.

Now, we just need a small piece of JavaScript to detect when the payment gateway is changed by the user. This triggers the WooCommerce update_checkout event which, in turn, will re-trigger woocommerce_cart_calculate_fees.

Wrapping up

I hope this has been helpful in demonstrating a couple of different ways to add fees or discounts to the WooCommerce checkout. We looked at adding a fee to the WooCommerce payment method and we looked at ways to apply discounts depending on the gateway chosen.

Any questions, please leave a comment. You can find out more about the WooCommerce Fees and Discounts here.

WooCommerce Fees and Discounts

Create powerful pricing incentives quickly and easily

Find Out More


  1. I use the PayU payment gateway that works in Latin America. PayU allows you to pay with credit cards (Visa, Mastercard and Amex) and also debit card.
    I only wish to apply discount when selecting pay with Mastercard.
    Is this possible?

  2. In order to apply a percentage fee you could do something like this:

    function _add_checkout_fee_for_paypal()
    global $woocommerce;

    if (is_admin() && !defined(‘DOING_AJAX’)) {

    $chosen_gateway = $woocommerce->session->chosen_payment_method;
    $cart = $woocommerce->cart;

    // it’s either ‘paypal’ or ‘ppec_paypal’ for PayPal Express Checkout
    if (strpos($chosen_gateway, ‘paypal’) !== false) {
    $percentage = 0.029;
    $surcharge = (($cart->cart_contents_total + $cart->shipping_total) * $percentage) + 0.30;
    // ‘Fee’ is the GUI label
    $cart->add_fee(__(‘Fee’, ‘woocommerce’), $surcharge);

  3. Hi, this is very nice plugin. I’m just testing it and wondering if there is a way to not display and add fee to subtotal in the cart?

    For example if PayPal is my default payment option and I have fee set to $5 then in the cart that fee will be displayed and added to subtotal.

    This is not ideal because customer can change payment method on checkout and that fee displayed in cart can be misleading.

    Is there a way to disable adding payment fee in cart?


        • You’d might need to modify your cart template file. I’m not sure if it’s advisable to hide fees on the cart page – it might confuse the user when they progress to the checkout page and the total changes.

          • Thank you.

            I think equally confusing is to add a payment fee to cart subtotal before customer has chosen payment option. Customer may not pay that fee at all in the end if he/she pick alternative payment option which not include additional fees, like a bank transfer.

            Better idea is to add and show that fee on checkout step – after customer decided what payment option will be using.

            Have a good day.

            • That’s fine. But if your default payment gateway is PayPal and you’re adding a $5 fee for paying with this method, then it’s good practice to show this to the user on the cart page. If they change the payment gateway on the checkout, then go back to the cart page for any reason, the fee will no longer be displayed.

              • You’re right 🙂

                So maybe fee should be displayed in cart AFTER they picked payment method not BEFORE?

                I still think it’s a bit confusing for customer to have additional fees in their cart based on assumption that might be not true.

  4. Hello, I am working on an online shop, where the request is that the Tax class of the extra fee charged for COD should be chosen based on the product that is selected in the cart.
    For example if the selected product has 7% tax, COD extra fee should have same Tax class as well, or if the selected product has 19% then COD fee should have 19% Tax as well.
    I am able to do this for shipment fee but not or COD Fee. Can you let me know i this plugin has that option. I see that it provides and option for tax class, but what are the options on dropdown?
    Thank you in advance.

  5. Hi,

    Does this work with custom gateways? For instance, our website uses a local service, WiPay, to manage our credit card transactions. So it’s not a built in woocommerce gateway.

  6. Hello, I need help to make the code apply a percentage fee.

    I can’t figure out how to combine the code in the comment which has a percentage fee with the main code, on this awesome article.

    Please any help for me, I would really appreciate it

    Thanks in advance.

  7. Hi, I see it as a great solution for the country PayPal fee. Let’s say for Germany 1 eur, for Austria 2 eur .. how to change the code, to check the country code, and apply a fee .. thank you very much for the great text…

  8. Hi
    I would like to add obliged to select services with charges to my check out page.Is there a plugin that can do that ?

  9. Could I apply both a fee and discount at the same time for the same payment gateway? We would need to do that to follow the European Union rules. It is not allowed to apply a fee to only one payment gateway. If a fee is applied it has to be applied to all payment gateways and it has to be the same, according to the EU-rules.

    Therefore we want to apply a standard fee to all payment gatways, and then a discount to certain payment gateways. (discounts for a certain gateway are allowed).

Leave a Reply

Your email address will not be published. All fields are required.