Extra Fee & Surcharge for Magento 2 Checkout
Add extra fees to the Magento 2 cart and checkout with rules by payment method, customer group, country, subtotal, quantity, products, categories and dates, or a simple small order fee. Each fee is stored with the order and shows in invoices, credit memos and emails.
- Free
- Themes listed: Hyvä + Luma
composer require mage2kishan/module-extra-fee
- Package requirementsRead the source documentation
- Developer profileView Upwork profile
- Themes listedHyvä + Luma
- PHP versions listed8.1, 8.2, 8.3, 8.4
- Installation questionsDiscuss your store setup
What it does for your store
The main features, as listed in the module documentation.
-
Fee rules
Any number of rules with sort order and a Stop Further Rules flag. Conditions: store view, website, customer group, payment method, country, subtotal, quantity, products, categories and dates.
-
Four fee types
Fixed Amount, Percentage of Subtotal, Fixed + Percentage and Percentage with Fixed Minimum, applied per order, per product or per quantity, with minimum and maximum caps.
-
Fee lines on totals and documents
Cart totals on Hyvä and Luma, the Luma checkout summary, customer order pages, invoices, credit memos, PDFs, emails and the admin order pages.
-
Order Fees grid
An admin grid of every fee charged per order with invoiced and refunded amounts and CSV export, plus an Extra Fee column in Items Ordered.
Installation
Example commands from the Magento root. Follow the package instructions and your staging and deployment process.
- 1Check the releaseMatch Magento, PHP, theme and dependency requirements.
- 2Install on stagingReview Composer changes and follow the package instructions.
- 3Configure and verifyUse the documented settings and test the affected features.
$ composer require mage2kishan/module-extra-fee $ bin/magento setup:upgrade $ bin/magento setup:di:compile $ bin/magento setup:static-content:deploy -f $ bin/magento cache:clean
Listed requirements
These are the details supplied in this listing. Confirm the selected release supports your Magento edition, PHP and storefront.
| Magento versions listed | 2.4.6, 2.4.7, 2.4.8 |
|---|---|
| PHP versions listed | 8.1, 8.2, 8.3, 8.4 |
| Themes listed | Hyvä, Luma |
| Composer package | mage2kishan/module-extra-fee |
Documentation
Product details and setup guidance. Check the package repository for release-specific instructions.
Rule based extra fees for the Magento 2 checkout
Extra Fee (Panth_ExtraFee) adds fees and surcharges to the Magento 2 cart and checkout, for example a cash on delivery fee, a handling fee for small orders or a surcharge for some countries or customer groups. Each fee is a separate total that is stored with the order and carried into invoices and credit memos.
What it adds
- Fee rules managed in an admin grid, with Active, Sort Order and Stop Further Rules. Empty conditions mean no restriction.
- Conditions: store views, websites, customer groups, payment methods, countries (shipping or billing address), minimum and maximum subtotal, minimum and maximum quantity, specific products, categories and a date range in the store's timezone.
- Fee types Fixed Amount, Percentage of Subtotal, Fixed + Percentage and Percentage with Fixed Minimum. The fixed part can apply per order, per product line or per unit.
- Per rule minimum and maximum fee, and a store wide Maximum Total Fee Per Order that scales all fees down.
- A Small Order Fee in Stores > Configuration that needs no rule.
- Fee lines as separate rows or one combined row, shown excluding tax, including tax or both.
- An Order Fees grid with invoiced and refunded amounts and CSV export, an Extra Fee column in the admin Items Ordered table and an optional Extra Fees column in the Sales > Orders grid.
- A sample data command,
bin/magento panth:extrafee:install-sample-data, that creates eight example rules.
Settings
Stores > Configuration > Panth Extensions > Extra Fee, at default, website and store view scope. Rules are under Extra Fee > Fee Rules.
Things to know before installing
- Tax on fees is calculated and stored for every fee, but it is only added to the order tax and grand total when you set Charge Tax On Fees to Yes. The default is No.
- Fees cannot be negative, so the module cannot be used for discounts.
- A rule with payment methods applies only after the customer has chosen a payment method.
- Credit memos refund fees from rules marked Is Refundable and the small order fee.
- Fees are skipped for orders created in the admin unless you enable Apply Fees to Admin Orders.
- With multishipping, the fees apply once, to the first address that has items.
- On Hyvä the fee rows are added to the cart totals. The checkout summary component is the Luma Knockout one.
Requirements
- Magento Open Source or Adobe Commerce 2.4.4 to 2.4.8.
- PHP 8.1, 8.2, 8.3 or 8.4.
- Panth Core (
mage2kishan/module-core), installed by Composer.
Free and open source under the MIT License.
Developer notes
- PHP namespace:
Panth\ExtraFee. - Totals: code
panth_extra_feeinetc/sales.xml, sort order 460 in thequotesection and 450 inorder_invoiceandorder_creditmemo. Quote total segments are namedpanth_extra_fee_<rule_id>, withpanth_extra_fee_0for the small order fee. - Rules from code:
Api\FeeRuleRepositoryInterface(save,getById,getList,delete,deleteById) andApi\Data\FeeRuleInterface. Theregionsandproduct_skuscolumns are evaluated by the condition checker but have no form field, so set them through the repository. - Calculation:
Model\Calculator\FeeCalculator(calculateFees,calculateAmount,calculateSmallOrderFee,calculateTax) andModel\Calculator\ConditionChecker(isRuleValid). - Order and document observers:
Observer\SaveOrderFeesonsales_model_service_quote_submit_successandcheckout_submit_all_after,Observer\RegisterInvoiceFeesonsales_order_invoice_register,Observer\RegisterCreditmemoFeesonsales_order_creditmemo_refund, andObserver\MarkMultishippingOrderoncheckout_type_multishipping_create_orders_single(frontend). - Admin route front name:
panth_extrafee. ACL resources:Panth_ExtraFee::config,Panth_ExtraFee::extra_fee,Panth_ExtraFee::manage_rulesandPanth_ExtraFee::view_order_fees. - Tables:
panth_extra_fee_rule,panth_extra_fee_quoteandpanth_extra_fee_order. - Columns on
sales_invoiceandsales_creditmemo:panth_extra_fee_amount,panth_base_extra_fee_amount,panth_extra_fee_tax,panth_base_extra_fee_taxandpanth_extra_fee_details(JSON fee lines). - Logging: messages prefixed
Panth_ExtraFee:go to the standard Magento log files throughPsr\Log\LoggerInterface. The filevar/log/panth_extra_fee.logis configured inetc/di.xmlbut is not written in this version.
| Module Category | Cart & Checkout |
|---|---|
| Best For | All Sizes |
Questions before you install?
Send me your composer.json and I will check for conflicts first. Free. Installation is +$45, custom work is quoted first.