Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 07-31-2026 14:33:00

antsevo
Member
From: West Sussex, UK
Registered: 02-08-2005
Posts: 642
Website

EU Customs and Duties

I have installed the EU Customs Script.

However I use PDDP - I pay for the taxes, duties and fees, actually the customer pays me and I pay it in royal mail


I have a base starting price for 1 product of £5.79 each addition product they buy adds £0.85

So, I already have the base price, but I need to add 85p for each additional item in the cart

I assume this should be done in my custom shipping methods.

Has anyone any pointer to this

or

is there a way it can be added into the EU Customs and Duties script.

Not too sure what would be easier


Anthony - Manufacturers of Personalised and Celebrity Face Masks

Offline

 

#2 07-31-2026 15:20:08

antsevo
Member
From: West Sussex, UK
Registered: 02-08-2005
Posts: 642
Website

Re: EU Customs and Duties

I think I have solved it... I am using a base of £6.00 for duties and an extra £1 for each item in the cart.... it seems to work, so have posted it here:

<?php

// +--
// | EU Flat Customs Duty Controls.  Designed for use on Kryptronic eCommerce
// | versions 9.0.1 and greater.  Versions 9.0.1 through 9.0.3 use iseu logic
// | and versions 9.1.0 and greater use region logic to identify EU countries.
// |
// | Use the country_duty array to override duty on the country level.  The duty
// | calculated by this script is flat rate per line item for line items under
// | a set amount.  The duty rate and max are to be entered in Euros.
// +--

$display_duty  = 'Customs & Taxes - Paid by Funkybunky';
$default_duty  = 1.00;
$maxline_total = 150.00;

$country_duty = array('France'  => 1.00,
                      'Romania' => 2.00);

// +--
// | Load objects, cart, checkout session, address book, currency info,
// | and build a list of EU countries.
// +--

$CORE_DB  =& $this->quick_object('CORE_DB','core','CORE_DB_1');
$CORE_App =& $this->quick_object('CORE_App','core');

$cartids = $this->globals('ecom.checkout_cartids');
$cosess  = $this->globals('ecom.checkout_cosess');
$addbook = $this->globals('core_session.addbook');

$currcore = $this->globals('core_settings.core.basecurrency');
$currconv = 'EUR';

$countries = array();

$sql = 'SELECT * FROM core_country';
$res = $CORE_DB->sql_do(array('sql' => $sql, 'table' => 'core_country', 'order' => array('id' => 'ASC')));

if ((!($this->isError($res))) && (!(empty($res)))) {

     foreach ($res as $num => $data) {

          if     ($data['id'] == 'UK - Northern Ireland') {$countries[$data['id']] = 'EU';}
          elseif (!(empty($data['region'])))              {$countries[$data['id']] = $data['region'];}
          elseif (!(empty($data['iseu'])))                {$countries[$data['id']] = 'EU';}
          else                                            {$countries[$data['id']] = 'OTHER';}

     } // End of foreach statement.

} // End of if statement.

if (empty($countries)) {return 1;}

// +--
// | Loop through our cart and identify any items being exported to
// | into the EU from outside the EU.
// +--

$exports = array();

foreach ($cartids as $cartid => $cartdata) {

     if (empty($cartdata['sinshipinfo']))                      {continue;}
     if (empty($cosess['items'][$cartid]))                     {continue;}
     if (empty($addbook[$cosess['items'][$cartid]['deladd']])) {continue;}

     $origincountry = $cartdata['sinshipinfo']['shipcountry'];
     $destcountry   = $addbook[$cosess['items'][$cartid]['deladd']]['country'];

     if ((empty($countries[$origincountry])) || (empty($countries[$destcountry]))) {continue;}
     if ($countries[$origincountry] == 'EU')                                       {continue;}
     if ($countries[$destcountry] != 'EU')                                         {continue;}     

     if (!(isset($exports[$destcountry]))) {$exports[$destcountry] = array('lines' => 0, 'quantity' => 0, 'total' => 0.00);}

     $exports[$destcountry]['lines']++;
     $exports[$destcountry]['quantity'] += $cartdata['quantity'];
     $exports[$destcountry]['total']    += $cartdata['subtotal'];

} // End of foreach statement.

if (empty($exports)) {return 1;}

// +--
// | Handle charges for exports.  Everything is compared using EUR
// | and converted back to the base currency for the total.
// +--

$totalduty = 0.00;

foreach ($exports as $country => $exportinfo) {

     $exportduty = $default_duty;

     if (!(empty($country_duty[$country]))) {$exportduty = $country_duty[$country];}
     if (empty($exportduty))                {continue;}

     $converted_total = $exportinfo['total'];

     if ($currcore != $currconv) {$converted_total = $CORE_App->price_round($converted_total * $this->globals('core_settings.core.currconv.' . $currconv));}

     if ($converted_total > $maxline_total) {continue;}

     $newtotalduty = $CORE_App->price_round($totalduty + ($exportduty * $exportinfo['lines']));
     $extraitemcost = 6.00;
     $totalduty = $newtotalduty + $extraitemcost;

} // End of foreach statement.

if (empty($totalduty)) {return 1;}

if ($currcore != $currconv) {$totalduty = $CORE_App->price_round($totalduty / $this->globals('core_settings.core.currconv.' . $currconv));}


Anthony - Manufacturers of Personalised and Celebrity Face Masks

Offline

 

#3 08-03-2026 08:16:46

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19988
Website

Re: EU Customs and Duties

Thanks for posting this.  Your script looks good and should work as you intend it to.


Nick Hendler

Offline

 

#4 08-05-2026 02:51:27

antsevo
Member
From: West Sussex, UK
Registered: 02-08-2005
Posts: 642
Website

Re: EU Customs and Duties

Thanks Nick, its implemented and seems to be what I need... thanks again for checking


Anthony - Manufacturers of Personalised and Celebrity Face Masks

Offline

 

Board footer