The Shipping Surcharge plugin allows you to impose an additional shipping charge for a specific zone.
https://www.zen-cart.com/downloads.php?do=file&id=2308
Printable View
The Shipping Surcharge plugin allows you to impose an additional shipping charge for a specific zone.
https://www.zen-cart.com/downloads.php?do=file&id=2308
Brilliant little Mod - I didn't want to restructure my whole shipping module for Northern Ireland and Isle of Man so this was a beautiful workaround.
Nice1 SWGuy :thumbsup:
Updated version 1.1 has weight and value thresholds in case you want to check those before imposing the surcharge.
Looks like this version may have introduced an issue for stores performing a new install. Discussion is had at the following forum thread: https://www.zen-cart.com/showthread....rcharge-module
This issue has been fixed in version 1.2, which is now available.
I like the ability to add a surcharge using a weight threshold in the shipping surcharge module and I was wondering if it would be possible to add dimension thresholds for oversized items that UPS, FedEx, USPS or others charge more to ship. Thanks.
This could certainly be done but it would not be the kind of thing I would release as an open source module. You are welcome to work with me or any other developer if you'd like to make this change on your cart.
There was a bug in specifying the zone for this module that has been fixed in the new version.
I'm looking for a module for "tariff surcharge" and this module looks good.
I tested it under zc158 and it shows some warning.
1.
Line 78 is the following.PHP Code:
[16-Apr-2025 12:05:52 America/New_York] Request URI: /index.php?main_page=checkout_one, IP address: xxxx, Language id 1
#0 /includes/modules/order_total/ot_shippingsurcharge.php(78): zen_debug_error_handler()
#1 /includes/classes/order_total.php(99): ot_shippingsurcharge->process()
#2 /includes/modules/pages/checkout_one/header_php.php(347): order_total->process()
#3 /index.php(35): require('/home4/...')
--> PHP Warning: A non-numeric value encountered in /includes/modules/order_total/ot_shippingsurcharge.php on line 78.
My fix. Change this line toPHP Code:
$shipping_surcharge = ($order->info['subtotal'] * (MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT/100));
2.PHP Code:
$shipping_surcharge = ($order->info['subtotal'] * ((float)MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT/100));
Line 89 is the following.PHP Code:
[16-Apr-2025 12:16:48 America/New_York] Request URI: /index.php?main_page=checkout_one, IP address: xxx, Language id 1
#0 /includes/modules/order_total/ot_shippingsurcharge.php(89): zen_debug_error_handler()
#1 /includes/classes/order_total.php(99): ot_shippingsurcharge->process()
#2 /includes/modules/pages/checkout_one/header_php.php(347): order_total->process()
#3 /index.php(35): require('/home4/...')
--> PHP Warning: Undefined array key "Sales Tax" in /includes/modules/order_total/ot_shippingsurcharge.php on line 89.
Not sure how to fix it. My fix is to comment the this line out. It seems no affect on my checkout page.PHP Code:
$order->info['tax_groups']["$tax_description"] += zen_calculate_tax($shipping_surcharge, $tax);
Also this surcharge doesn't apply on my sales tax (local sales tax), which seems normal anyway, since it is a surcharge.
Your second problem is due to the fact there is no tax applied but module try to calculate it anyway. Suppressing this line won't work if you want to apply some tax on the surcharge, which is probably the case if you already applied some tax everywhere else.
You can modify code as follow:
PHP Code:
if ($charge_it) {
$tax_address = zen_get_tax_locations();
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
// calculate from flat fee or percentage
if (substr(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT, -1) == '%') {
$shipping_surcharge = ($order->info['subtotal'] * ((float)MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT/100));
} else {
$shipping_surcharge = MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT;
}
$order->info['total'] += $shipping_surcharge;
if ($tax > 0) {
$tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
$order->info['tax'] += zen_calculate_tax($shipping_surcharge, $tax);
$order->info['tax_groups'][$tax_description] += zen_calculate_tax($shipping_surcharge, $tax);
$order->info['total'] += zen_calculate_tax($shipping_surcharge, $tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$shipping_surcharge += zen_calculate_tax($shipping_surcharge, $tax);
}
}
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($shipping_surcharge, true, $order->info['currency'], $order->info['currency_value']),
'value' => $shipping_surcharge);
}
Another issue, but it is not critical to me.
Under the order-total, there is an option under this surcharge plug-in: Charge a Shipping Surcharge. By default, it is set to true. I checked my checkout page, and the surcharge only applied to the sub-total number. Shipping is not included. But anyway, I don't plan to apply surcharge on the shipping.
If I set this option to false, surcharge option is missing under the OPC checkout page. If I select different shipping options, the following warning is generated.
Line 143 in order_total.php is the following in my code:PHP Code:
[19-Apr-2025 11:30:15 America/New_York] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /includes/classes/order_total.php:143
Stack trace:
#0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(428): order_total->output()
#1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(92): zcAjaxOnePageCheckout->createOrderTotalHtml()
#2 /ajax.php(92): zcAjaxOnePageCheckout->updateShippingSelection()
#3 {main}
thrown in /includes/classes/order_total.php on line 143
[19-Apr-2025 11:30:15 America/New_York] Request URI: /ajax.php?act=ajaxOnePageCheckout&method=updateShippingSelection, IP address: xxxx
--> PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /includes/classes/order_total.php:143
Stack trace:
#0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(428): order_total->output()
#1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(92): zcAjaxOnePageCheckout->createOrderTotalHtml()
#2 /ajax.php(92): zcAjaxOnePageCheckout->updateShippingSelection()
#3 {main}
thrown in /includes/classes/order_total.php on line 143.
PHP Code:
$size = count($GLOBALS[$class]->output);
The option you set to false is the one that activates the shipping surcharge... Which is why it does not appear anymore in checkout page. I know some other modules have an option to include shipping fee in calcuation at this place, but this one does not. There are few weird things in this module, if I have time, I might rewrite it.
Your log is an OPC problem, I have seen the same here, but there was no answer due to a lack of information from poster.
I submitted an updated version in plugins section here. It should be available in few days.
The OPC log above might be link to the fact the module was always activated even when calculation is de-activated by the option 'Charge a Shipping Surcharge'.
Thanks for your help and contribution! I will try the new plug-in when it is available and let you know.
This plug-in will benefit many sellers under the current tariff condition...
It is available now!
Forgot the link:
https://www.zen-cart.com/downloads.php?do=file&id=2308
Hi @pilou2, I just tried v2.0.0 and it worked great on my end. No warnings.
One small issue, but it doesn't bother me: "Tax Class" options still doesn't work. There is no change on the surcharge value, no matter Taxable Goods is selected or not. But anyway, I don't plan to surcharge the sales tax. I used the local sales tax module here.
I see. Thanks for your info.