PHPackages                             pronamic/pronamic-payment-gateways-fees-for-woocommerce - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. pronamic/pronamic-payment-gateways-fees-for-woocommerce

ActiveWordpress-plugin[Payment Processing](/categories/payments)

pronamic/pronamic-payment-gateways-fees-for-woocommerce
=======================================================

This WordPress plugin adds settings to all WooCommerce gateways to add a fixed and/or variable (percentage) fee.

v1.0.3(10mo ago)3198[1 issues](https://github.com/pronamic/pronamic-payment-gateways-fees-for-woocommerce/issues)proprietaryPHPPHP &gt;=8.0

Since Oct 31Pushed 10mo ago4 watchersCompare

[ Source](https://github.com/pronamic/pronamic-payment-gateways-fees-for-woocommerce)[ Packagist](https://packagist.org/packages/pronamic/pronamic-payment-gateways-fees-for-woocommerce)[ Docs](https://www.pronamic.shop/product/pronamic-payment-gateways-fees-for-woocommerce/)[ RSS](/packages/pronamic-pronamic-payment-gateways-fees-for-woocommerce/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (5)Used By (0)

[![](assets/github-banner.png)](assets/github-banner.png)

Pronamic Payment Gateways Fees for WooCommerce
==============================================

[](#pronamic-payment-gateways-fees-for-woocommerce)

This WordPress plugin adds settings to all WooCommerce gateways to add a fixed and/or variable (percentage) fee.

[![Latest Stable Version](https://camo.githubusercontent.com/f03744c6288ca930c5c5c1b7e755c24b9788a2d397b5fc6b93ced9597f6a06bd/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f70726f6e616d69632d7061796d656e742d67617465776179732d666565732d666f722d776f6f636f6d6d657263652f76)](https://packagist.org/packages/pronamic/pronamic-payment-gateways-fees-for-woocommerce)[![Total Downloads](https://camo.githubusercontent.com/2c808a306c6e7184026c445dd440c328f054c583d4ceffe179c5e7c264c0eff3/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f70726f6e616d69632d7061796d656e742d67617465776179732d666565732d666f722d776f6f636f6d6d657263652f646f776e6c6f616473)](https://packagist.org/packages/pronamic/pronamic-payment-gateways-fees-for-woocommerce)[![Latest Unstable Version](https://camo.githubusercontent.com/26bb5a46a8fb026c262ab02c1f424464d0628f75f509ee87b8c4b35575ec8066/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f70726f6e616d69632d7061796d656e742d67617465776179732d666565732d666f722d776f6f636f6d6d657263652f762f756e737461626c65)](https://packagist.org/packages/pronamic/pronamic-payment-gateways-fees-for-woocommerce)[![License](https://camo.githubusercontent.com/1f2e5544a410df22c48daccb746c1dbe8192df9fd7ea5a9768f798212f36b2bb/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f70726f6e616d69632d7061796d656e742d67617465776179732d666565732d666f722d776f6f636f6d6d657263652f6c6963656e7365)](https://packagist.org/packages/pronamic/pronamic-payment-gateways-fees-for-woocommerce)[![PHP Version Require](https://camo.githubusercontent.com/3d4512f2c604c8280d88c06a288262649634dd1e6e2c8dd05a19b9bbfcb60185/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f70726f6e616d69632d7061796d656e742d67617465776179732d666565732d666f722d776f6f636f6d6d657263652f726571756972652f706870)](https://packagist.org/packages/pronamic/pronamic-payment-gateways-fees-for-woocommerce)

- [Introduction](#introduction)
- [Installation](#installation)
- [Screenshots](#screenshots)
- [Flow](#flow)
- [Links](#links)

Introduction
------------

[](#introduction)

This WordPress plugin adds settings to all WooCommerce gateways to add a fixed and/or variable (percentage) fee.

Installation
------------

[](#installation)

```
composer require pronamic/pronamic-payment-gateways-fees-for-woocommerce

```

```
\Pronamic\WooCommercePaymentGatewaysFees\Plugin::instance()->setup();
```

Screenshots
-----------

[](#screenshots)

[![Screenshot of the WooCommerce direct bank transfer payment method settings page in the WordPress admin dashboard with the extra fees settings.](assets/screenshot-1.png)](assets/screenshot-1.png)

Flow
----

[](#flow)

WooCommerce recommends using the `woocommerce_cart_calculate_fees` hook to add fees:

> We suggest using the action woocommerce\_cart\_calculate\_fees hook for adding fees.

*Source: *

This hook is called as soon as the `WC()->cart->calculate_totals()` function is called, WooCommerce uses the `WC_Cart_Totals` class to calculate totals:

**`class-wc-cart.php`**

```
/**
 * Calculate totals for the items in the cart.
 *
 * @uses WC_Cart_Totals
 */
public function calculate_totals() {
	$this->reset_totals();

	if ( $this->is_empty() ) {
		$this->session->set_session();
		return;
	}

	do_action( 'woocommerce_before_calculate_totals', $this );

	new WC_Cart_Totals( $this );

	do_action( 'woocommerce_after_calculate_totals', $this );
}
```

*Source: *

When creating a `WC_Cart_Totals` instance, the `WC_Cart_Totals->calculate()` function is executed:

**`class-wc-cart-totals.php`**

```
/**
 * Run all calculation methods on the given items in sequence.
 *
 * @since 3.2.0
 */
protected function calculate() {
	$this->calculate_item_totals();
	$this->calculate_shipping_totals();
	$this->calculate_fee_totals();
	$this->calculate_totals();
}
```

*Source: *

What can be seen here is that the final totals are calculated after calculating the fee totals. This means that the order total is not yet available within the `woocommerce_cart_calculate_fees` hook. In other words, within the `woocommerce_cart_calculate_fees` hook the result of `$cart->get_total( '' )` will always be `0`.

This is inconvenient because the payment gateway fees are often based on the total amount to be paid. That's why we hook into the `woocommerce_after_calculate_totals` hook and recalculate the totals again. This extra calculation seems double, but it seems to be the easiest way to reliably request the cart total.

Links
-----

[](#links)

-

[![Pronamic - Work with us](https://github.com/pronamic/brand-resources/raw/main/banners/pronamic-work-with-us-leaderboard-728x90%404x.png)](https://www.pronamic.eu/contact/)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance46

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~199 days

Total

4

Last Release

327d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/869674?v=4)[Remco Tolsma](/maintainers/remcotolsma)[@remcotolsma](https://github.com/remcotolsma)

---

Top Contributors

[![remcotolsma](https://avatars.githubusercontent.com/u/869674?v=4)](https://github.com/remcotolsma "remcotolsma (76 commits)")[![rvdsteege](https://avatars.githubusercontent.com/u/10371164?v=4)](https://github.com/rvdsteege "rvdsteege (3 commits)")

---

Tags

paymentpayment-gatewaypaymentspronamicpronamic-paysurchargesurcharge-feewoocommercewoocommerce-extensionwoocommerce-paymentwoocommerce-pluginwordpresswordpress-developmentwordpress-pluginwordpresspaymentpaymentsgatewaywordpress pluginpronamicwoocommercegatewaysfeessurchargeswoocommerce-pluginsurchargesurcharge-fee

### Embed Badge

![Health badge](/badges/pronamic-pronamic-payment-gateways-fees-for-woocommerce/health.svg)

```
[![Health](https://phpackages.com/badges/pronamic-pronamic-payment-gateways-fees-for-woocommerce/health.svg)](https://phpackages.com/packages/pronamic-pronamic-payment-gateways-fees-for-woocommerce)
```

###  Alternatives

[wp-pay/core

Core components for the WordPress payment processing library.

29119.8k97](/packages/wp-pay-core)[wp-pay-extensions/gravityforms

Gravity Forms driver for the WordPress payment processing library.

1133.3k2](/packages/wp-pay-extensions-gravityforms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
