RestroPress – Extra Fees
On this page
Extra Fees adds a fee to the order at checkout. The fee can be a flat amount or a percentage, it can depend on the payment gateway the customer chooses and on whether the order is pickup or delivery, and it can be limited to items from selected menu categories. Use it for things like packaging charges, card-payment surcharges or a pickup handling fee.
Requirements#
- RestroPress, installed and active. The plugin shows an admin notice if RestroPress is missing; it does not state a minimum version in its header. The readme lists WordPress 4.0 or later as the minimum and 7.1 as the version it was tested up to.
- At least one enabled payment gateway. The fee amounts are entered per gateway, and no fee is added when no gateway can be resolved.
Installation#
- In Plugins › Add New › Upload Plugin, choose the ZIP file and select Install Now.
- Select Activate.
- Open the settings from the Settings link on the Plugins screen, or go to RestroPress › Settings › Misc › Extra Fees.
This plugin does not include a licence key field. Nothing in its code checks a licence or handles updates, so there is no key to enter.
Settings#
All settings are in RestroPress › Settings › Misc › Extra Fees. Nothing is charged until Enable is ticked.

| Setting | What it does | Default |
|---|---|---|
| Enable | Checkbox labelled "Enable Extra Fees". Turns the whole extension on or off. | Off |
| Category Fee Rules | A table of rules, described below. Click Add Fee Rule to add a row and Remove to delete one. | No rules |
| Fee Name | Label of the legacy (fallback) fee shown in the cart and on the order. | Extra Fee |
| Fee Type | Legacy fee: Flat Rate or Percentage. A percentage is calculated on the cart subtotal. | Not set (treated as percentage) |
| Service Type | Legacy fee: tick Pickup, Delivery or both. The fee only applies to ticked service types. | None ticked |
| Fee Amount (one field per gateway) | Legacy fee: one field per payment gateway, labelled "Fee Amount" followed by the gateway name. The amount is a currency amount for Flat Rate and a percentage for Percentage. Leave a gateway empty or 0 for no fee on that gateway. | Empty |
Category Fee Rules#
Each rule is one row with these columns:
- Label: the name shown on the cart line. The placeholder suggests "Packaging Fee".
- Fee Type: Flat Rate or Percentage.
- Service Type: Pickup and/or Delivery.
- Categories: one or more menu categories. The rule only looks at cart items that belong to at least one of them.
- Gateway Amounts: an amount per payment gateway. A gateway left empty or at 0 gets no fee from this rule.
A rule is discarded when it is saved if it has no label, no service type, no category or no gateway amount above zero.
Rules and the legacy fee#
- Every matching rule is added, so a cart can carry several extra fees at once.
- A flat rule adds its amount once per rule, however many matching items are in the cart. A percentage rule is calculated on the subtotal of the matching items only, not the whole cart.
- The legacy fields (Fee Name, Fee Type, Service Type, Fee Amount per gateway) are used only when no category rule produced a fee for the current cart, service and gateway.
How it works#
Customer side#
- The customer builds a cart and chooses Pickup or Delivery.
- The extension works out which payment gateway applies. It uses, in order: a gateway named in the request, the saved
payment_modecookie, the store's default gateway, the gateway RestroPress reports as chosen, and finally the first enabled gateway. - It removes any fee it added earlier and recalculates, so fees never stack up. The result appears as a fee line in the cart summary and checkout, and is included in the total.
- The fee is recalculated when the service option changes, when the checkout form loads the payment section, when items are added, removed or have their quantity changed, and when the customer switches gateway on the checkout page. The checkout script refreshes the order summary after a gateway change.
- On RestroPress 3.4 and later the checkout service chips also show the extra fee for a service even while the other service is selected.
The fee is added as an ordinary RestroPress fee, so it is saved with the order like other fees. It is not flagged as tax-exempt, so when taxes are enabled RestroPress may calculate tax on it. Check a test order if this matters for your tax setup.
Restaurant side#
There is no separate report or screen. The fee shows as a fee line on the order, receipt and emails wherever RestroPress lists order fees.
User app#
When the RestroPress user app endpoint /user-api/v1/home is called, the extension adds an extra_fee block to the response data with the enabled flag, fee name, fee type, the Stripe amount, and the pickup and delivery flags of the legacy fee. Category rules are not included in that block.
Developer reference#
The extension does not fire its own hooks. It hooks into RestroPress and exposes a few helper functions.
| Name | Type | Parameters | Purpose |
|---|---|---|---|
rp_apply_extra_fee | function | $gateway | Removes this extension's fees from the cart and adds the ones that apply for the gateway. |
rp_get_service_extra_fee_total | function | $service_type, $gateway = '' | Returns the extra fee that would apply for a service and gateway without changing the cart. |
rp_get_effective_extra_fee_gateway | function | none | Returns the gateway slug the extension would use for the current request. |
rp_remove_all_extra_fee_rules | function | none | Removes the fee ids extra_fee and extra_fee_rule_* from the cart. |
rpress_checkout_service_fee | filter used | $fee, $service_type | Adds this extension's fee to the figure shown on the checkout service chips. |
Cart fee ids are extra_fee for the legacy fee and extra_fee_rule_<rule id> for category rules. Settings are stored in the RestroPress options under rpress_extra_fees_active, rpress_extra_fees_rules, rpress_extra_fees_name, rpress_extra_fees_type, rpress_extra_fees_service_type and rpress_extra_fees_amount_<gateway>.
// What would a delivery order paid with Stripe be charged right now?
$fee = rp_get_service_extra_fee_total( 'delivery', 'stripe' );
Troubleshooting#
- No fee appears. Check that Enable is ticked, that the customer has chosen a service type (the fee is not applied without one), and that the amount for the active gateway is above zero. A rule needs at least one category that matches an item in the cart.
- A rule disappeared after saving. Rules without a label, a service type, a category or a gateway amount above zero are dropped on save.
- The fee is wrong after switching payment method. The fee is looked up per gateway. Make sure an amount is entered for every gateway you offer.
- Admin notice that RestroPress is required. The plugin looks for RestroPress and does nothing without it.
- Old fee shown on a cached page. Exclude the checkout page and the AJAX requests from page caching, because the fee is calculated per visitor.
Changelog highlights#
- 1.4.2: fixed a user app compatibility issue.
- 1.4.1: checkout fee and tax fragments refresh immediately on service or gateway changes; the checkout script is limited to the checkout page.
- 1.4.0: added repeatable category-based fee rules with per-rule label, fee type, service filter and per-gateway amounts; matching rules apply together; the old single fee remains as a fallback.
