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 06-24-2021 03:33:30

nigel
Member
From: Peterborough, UK
Registered: 04-27-2008
Posts: 418
Website

minimum order value for non UK orders

With the new rules regarding exports meaning more time processing the orders, is it possible to have a minimum order value for non UK orders, say £20? I have a custom shipping script applied to all products which offers free shipping within the UK on orders over £20 and normal shipping rates on orders outside the UK. Is it possible to add something to this?


Code:

<?php 

$info = $this->globals('ecom.customship');

if ((($info['country'] == 'United Kingdom')) && ($info['total'] >= 20) ) { 

         $custom = array('Standard Delivery 2-4 Business Days' => 0, 'Express Delivery 1-2 Business Days' => 2.08);

} else {

     $ECOM_Ship =& $this->quick_object('ECOM_Ship','ecom');

     $zonearray = array('weight'        => $info['weight'],
                        'total'         => $info['total'],
                        'country'       => $info['country'],
                        'postalcode'    => $info['postalcode']);

     $rateinfo = $ECOM_Ship->getrates_zone($zonearray,$info['packages']);

     foreach ($rateinfo as $ratenum => $ratedata) {

          $custom[$ratedata['name']] = $ratedata['amount'];

     } // End of foreach tatement.

} // End of if statement.

$this->globals('ecom.customship_response',$custom);

?>

Offline

 

#2 06-24-2021 08:39:40

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

Re: minimum order value for non UK orders

It's not easy to implement a UK-only order minimum, however are you open to adding a UK-only order surcharge for orders under £20?  Perhaps the difference between the total and £20?


Nick Hendler

Offline

 

#3 06-24-2021 10:39:37

nigel
Member
From: Peterborough, UK
Registered: 04-27-2008
Posts: 418
Website

Re: minimum order value for non UK orders

yes that could be a possibility, however, the surcharge needs to be on "non UK" orders i.e. orders we send from the UK to other countries.

Offline

 

#4 06-25-2021 09:19:26

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

Re: minimum order value for non UK orders

Add a Custom Surcharge Script using Store / Commerce / Custom Surcharge Methods with this logic:

Code:

<?php 

$cartids = $this->globals('ecom.checkout_cartids');
$country = $this->globals('core_session.country');

if (!(preg_match('/^UK /',$country))) {return 1;}

$subtotal = 0; foreach ($cartids as $cartid => $item) {$subtotal += ($item['subtotal'] * 1.20);}

if ($subtotal >= 20) {return 1;}

$this->globals('ecom.total_customsurcharge',(20 - $subtotal));
$this->globals('ecom.customsurcharge_text','Non-UK Minimum Order Charge');

?>

Note the item subtotal * 1.20 adds VAT back into the subtotal for the total calc.  You might want that, or you might not.  Then activate the script using the Custom Surcharge method and status settings managed with Store / Component / Settings / Checkout.


Nick Hendler

Offline

 

Board footer