joseph-leedy/module-custom-fees
Composer 安装命令:
composer require joseph-leedy/module-custom-fees
包简介
Adds configurable custom fees to orders
README 文档
README
Custom Fees for Magento 2
by Joseph Leedy
Custom Fees allows merchants to configure additional fees to be charged to customers when orders are placed.
Features
- Allows fees to be configured with a label and amount to be added to an order
- Custom fees configuration can be imported via a CSV spreadsheet
- Conditions can be defined to determine whether a custom fee should be applied to an order based on product and cart details, including specific product attributes, product SKU, cart subtotal, cart item count, total cart weight and more
- Custom fees can be applied as a fixed amount or a percentage of the order subtotal
- Custom fees are displayed for orders, invoices and credit memos in both the frontend and backend
- Custom fees can be charged and displayed including or excluding tax
- Custom fees can be refunded via Magento's credit memo functionality
- Discounts can be applied to custom fees using Cart Price Rules
- Includes a report detailing all charged custom fees for a given time period
- Fully compatible with the Hyvä theme (Hyvä Default, Hyvä CSP, Hyvä Checkout and Hyvä Checkout CSP)
Requirements
- PHP 8.1 or greater
- Magento Open Source 2.4.4 or greater, Adobe Commerce 2.4.4 or greater, or Mage-OS 1.0 or greater*
- MySQL 8.0.4 or greater, MariaDB 10.6.0 or greater, or a MySQL 8-compatible database server (for generating reports)
Note: Mage-OS compatibility has not been tested, but it is functionally equivalent to Magento Open Source 2.4.6 or greater.
Installation
This extension can be installed via Composer from Packagist by running these commands from a terminal on a Web server or in the desired installation location:
cd /path/to/your/store
composer require joseph-leedy/module-custom-fees
php bin/magento module:enable JosephLeedy_CustomFees
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Updating
This extension can be updated via Composer from Packagist by running these commands from a terminal on a Web server or in the desired installation location:
cd /path/to/your/store
composer update joseph-leedy/module-custom-fees
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Usage
Configuration
Custom Fees
Custom Fees can be added from the Magento Admin panel by going to Stores > Settings > Configuration > Sales > Sales > Custom Order Fees. The overall
display order of the Custom Fees block in relation to other totals shown in the
cart and checkout can be configured at Stores > Settings > Configuration > Sales > Sales > Checkout Totals Sort Order. All settings for this extension
can be configured in the Global (Default), Website or Store scope.
Report Aggregation
Report aggregation can be configured at Stores > Settings > Configuration > General > Reports > Custom Order Fees Report.
Taxes
Taxes can be configured at Stores > Settings > Configuration > Sales > Tax.
Available Settings
| Setting | Section | Description | Default |
|---|---|---|---|
| Tax Class for Custom Fees | Tax Classes | Sets the class used to determine fee tax amount | None |
| Custom Fees | Calculation Settings | Sets whether the custom fees entered include or exclude tax | Excluding Tax |
| Display Custom Fee Amount | Shopping Cart Display Settings | Controls how custom fees are shown in the Cart and Checkout | Excluding Tax |
| Display Custom Fee Amount | Orders, Invoices, Credit Memos Display Settings | Controls how custom fees are shown on the Sales pages | Excluding Tax |
Importing Custom Fees
The Custom Fees configuration page allows fees to imported from a CSV spreadsheet containing the following columns:
| Column | Description | Example |
|---|---|---|
| code | A unique code identifying the custom fee (allowed characters: "A-Z", "a-z", "0-9", "_") | example_fee |
| title | A short label describing the custom fee | "Example Fee" |
| type | The type of custom fee ("fixed" or "percent" [of order subtotal]) | "fixed" |
| status | Whether the custom fee is enabled or diasbled ("0", "disabled", "1", "enabled") | "enabled" |
| show_percentage | Optional - Whether or not to show the percentage next to the fee name ("0", "n", "no", "1", "y", "yes") | "yes" |
| value | The amount of the custom fee, in the store's default currency | 5.00 |
Example CSV Import Spreadsheet
code,title,type,status,show_percentage,value example_fee,"Example Fee",fixed,enabled,0,5.00
Configuring Adavanced Settings
Additional settings for a Custom Fee, including Conditions, can be found in the Advanced Settings dialog by clicking on the cog icon "⚙️."
Reporting
To view a report of the collected custom order fees, go to Reports > Sales > Custom Order Fees in the Magento Admin panel.
Note: For performance reasons, the report generation process makes use of special database functions that are only available in MySQL 8.0.4+ or MariaDB 10.6.0+. Errors or unexpected behavior may occur when using incompatible database server software versions.
Applying Discounts to Custom Fees
To apply a discount to a custom fee, go to Marketing > Promotions > Cart Price Rules in the Magento Admin panel and follow these instructions:
- Click on "Add New Rule" or select an existing rule
- Expand the "Actions" section and click on the "Apply to Custom Fee Amount" toggle
Note: To apply a discount to a specific custom fee, add an action condition by following these instructions:
- In the "Actions" section, under the "Apply the rule only to cart items matching the following conditions..." heading, click on the green plus icon
- Select "Custom Fee" from the condition dropdown
- Click on the ellipses button and choose the desired custom fee from the list
Support
If you experience any issues or errors while using this extension, please open an issue in the GitHub repository. Be sure to include all relevant information, including a description of the issue or error, what you were doing when it occurred, what versions of Magento Open Source or Adobe Commerce and PHP are installed and any other pertinent details. I will do my best to respond to your request in a timely manner.
License
The source code contained in this extension is licensed under the Open Software License version 3.0 (OSL-3.0) license. A copy of this license can be found in the LICENSE file included with the source code or online at https://opensource.org/licenses/OSL-3.0.
Copyright for the included source code is exclusively held by Joseph Leedy, all rights reserved.
History
A full history of the extension can be found in the CHANGELOG.md file.
Contributing
We welcome and value your contribution. For more details on how you can help us improve and maintain this tool, please see the CONTRIBUTING.md file.
Shout-Outs
Contributors
These wonderful people have helped this extension become what it is today, and I am truly grateful to them for their contributions:
- A huge thanks to @pykettk, @Vinai and @hostep for reviewing the Hyvä compatibility implementation in pull request #16 and suggesting improvements!️
Supporters
I owe the following fine folks a debt of gratitude for their continuing support:
joseph-leedy/module-custom-fees 适用场景与选型建议
joseph-leedy/module-custom-fees 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.14k 次下载、GitHub Stars 达 35, 最近一次更新时间为 2024 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「magento」 「magento 2」 「fees」 「adobe commerce」 「hyva」 「surcharges」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 joseph-leedy/module-custom-fees 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 joseph-leedy/module-custom-fees 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 joseph-leedy/module-custom-fees 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Package for implementing Ecommerce fees
Laravel MPdf : Easily generate PDF files with arabic support
Writes an Adobe IDML file out of a given content
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Magento - Clean up session extension
Adobe Connect Client Package For Laravel Based Applications
统计信息
- 总下载量: 1.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 36
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2024-09-25