# mageprince/module-extrafee

> Magento 2 Add Extra Fee To Order

`composer require mageprince/module-extrafee`

Canonical URL: https://packagento.com/mageprince/module-extrafee

## At a glance

- **Vendor**: mageprince (https://packagento.com/mageprince.md)
- **Latest version**: 3.0.1 — released 2025-08-19
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/mageprince/module-extrafee and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require mageprince/module-extrafee:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Magento 2 Add Extra Fee To Order

## README

The Extra Fee extension enables store admins to add additional charge to customer order. It allows the creation of unlimited rules based on flexible conditions, ensuring that extra fee are applied only when specific criteria are met.

##### ⚠️ Note: This extension supports only a single extra fee. If you need to apply multiple extra fees based on flexible rules and conditions, check out the <a href="https://commercemarketplace.adobe.com/mageprince-module-extrafee-pro.html">Mageprince Extra Fee Pro</a> extension.

## ✅ Compatibility

<b>Magento Open Source:</b> 2.3.x - 2.4.x </br>
<b>Adobe Commerce (on-prem):</b> 2.3.x - 2.4.x </br>
<b>Adobe Commerce (cloud)</b>: 2.3.x - 2.4.x </br>

## ✨ Key Features

- Enable or disable the extension from admin configuration
- Apply extra fees based on specific store views and customer groups
- Option to enable or disable refunds for extra fees
- Apply extra fees during admin order creation
- Fully supports multi-currency and multi-store environments
- Supports tax calculation on extra fees with configurable tax class selection
- Choose how to display extra fees: Inclusive, Exclusive, or Both tax formats
- Define sort order for displaying multiple extra fees
- Create flexible conditions using cart and product attributes
- Assign extra fees to specific shipping methods
- Define rules based on postcode, region, state, or country
- Apply fees to specific products, categories, or product attributes
- Display extra fees in order summaries, invoices, credit memos, sales emails, and PDFs

## 🚀 Installation Instructions

#### 1. Install via composer (Recommended)

Run the following Magento CLI commands:

```
composer require mageprince/magento2-extrafee
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
```

#### 2. Manual Installation

Copy the content of the repo to the Magento 2 `app/code/Mageprince/Extrafee`

Run the following Magento CLI commands:
```
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
```

## 🤝 Contribution

Want to contribute to this extension? The quickest way is to <a href="https://help.github.com/articles/about-pull-requests/">open a pull request</a> on GitHub.

## 🛠 Support

If you encounter any problems or bugs, please <a href="https://github.com/mageprince/magento2-extrafee/issues">open an issue</a> on GitHub.

## 📸 Screenshots

![1_checkout](https://github.com/user-attachments/assets/14f0dd39-ee15-4e6e-9b46-caa976a6fbbb)
![2_configuration_general](https://github.com/user-attachments/assets/c44062b8-3ee3-4911-a167-52af965737e8)
![3_configuration_fee](https://github.com/user-attachments/assets/44df80a2-e86c-4815-8a05-6a9267db075e)
![4_configuration_tax](https://github.com/user-attachments/assets/ba3d226c-545e-47b1-9df9-66719a88269f)
![5_menu](https://github.com/user-attachments/assets/4e4525b6-c7cc-4427-b0b6-394bb12c9324)
![6_conditions](https://github.com/user-attachments/assets/71c4062b-e3dc-486f-bd98-e1c9e1d87f16)
![7_condition_cart_attribute](https://github.com/user-attachments/assets/86000edc-9c0f-49eb-ab85-4fed4df36d34)
![8_condition_product_attributes](https://github.com/user-attachments/assets/fdf7b546-86f3-4570-a412-d157f3206b31)
![9_condition_product](https://github.com/user-attachments/assets/43ba4392-dec6-465c-a24e-9760ec4683fb)
![10_condition_category](https://github.com/user-attachments/assets/124e6516-afd1-45ea-8045-8c1ff8abfb91)

## Recent Versions

| Version | Released |
|---|---|
| 3.0.1 | 2025-08-19 |
| 3.0.0 | 2025-05-24 |

## Quality

Latest release (3.0.1) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | not tested | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Pass | 0 |  |
| PHPMD | Warning | 6 | 6 rule violations (UnusedFormalParameter:6) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 17 | 17 | – | – |
| 2.4.8 | – | 17 | 17 | – |
| 2.4.9 | – | – | Unknown | 17 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["mageprince/module-extrafee"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

mageprince is a Magento 2 vendor on Packagento. See https://packagento.com/mageprince.md for their full catalogue.

