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 02-15-2017 17:26:09

larry
Member
Registered: 07-21-2003
Posts: 437

Free Shipping / restrict to domestic USA?

We really like using the Auto Trigger Free Shipping Threshold, but the question has arisen - is there a way to limit it to Domestic shipping only?   Specifically, if it is an international order, no free shipping applies.  International rates are so expensive, it doesn't make economic sense to offer it.

Using the shopping cart Free Shipping system is so much easier than a custom shipping script.  We're hoping there is a way to limit the scope of the offer.


Laurie Stephens




Offline

 

#2 02-16-2017 08:00:26

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

Re: Free Shipping / restrict to domestic USA?

You will need to use a custom script to handle this, something that leverages realtime rates using the base functions as well as disables free shipping for international.  The example below pulls rates from UPS, FedEX and UPS.  Change as needed:

Code:

<?php 

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

$delinfo = array('stateprov'     => $info['stateprov'],
                 'country'       => $info['country'],
                 'postalcode'    => $info['postalcode'],
                 'rescom'        => $info['rescom'],
                 'shipstateprov' => $info['shipstateprov'],
                 'shipcountry'   => $info['shipcountry'],
                 'shipzip'       => $info['shipzip'],
                 'shipmethods'   => 'UPSTOOLS, USPS, FEDEX',
                 'shiptype'      => 'R');

$result = $this->include_namespace('ecom','shiprealtime',array('delinfo'  => $delinfo, 'packages' => $info['packages']));

if (!(empty($result))) {foreach ($result as $num => $service) {$custom[$service['name']] = $service['amount'];}}

if ($info['country'] != 'United States') {$this->globals('ecom.ship_freehandled',1);}

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

?>

Nick Hendler

Offline

 

#3 03-02-2017 19:15:14

larry
Member
Registered: 07-21-2003
Posts: 437

Re: Free Shipping / restrict to domestic USA?

Here is the Custom shipping script we're using to use Realtime rates +  The Free Shipping system built in, but restrict to the U.S. lower 48 states.

Code:

<?php 
// 022517 offers the free shipping functionality of the shopping cart ONLY to Domestic USA lower 48 states
$info   = $this->globals('ecom.customship');
$custom = array();

$delinfo = array('stateprov'     => $info['stateprov'],
                 'country'       => $info['country'],
                 'postalcode'    => $info['postalcode'],
                 'rescom'        => $info['rescom'],
                 'shipstateprov' => $info['shipstateprov'],
                 'shipcountry'   => $info['shipcountry'],
                 'shipzip'       => $info['shipzip'],
                 'shipmethods'   => 'USPS, FEDEX',
                 'shiptype'      => 'R');

$result = $this->include_namespace('ecom','shiprealtime',array('delinfo'  => $delinfo, 'packages' => $info['packages']));

if (!(empty($result))) {

   foreach ($result as $num => $service) {

       $methodname = $service['name'];
       if (!(empty($service['delest']))) {
             $methodname .= ' (' . $service['delest'] . ')';
       }
    
       $custom[$methodname] = $service['amount'];
   }    
}  
   
 if (($info['country'] == 'United States') &&  ($info['stateprov'] != 'Alaska') &&  ($info['stateprov'] != 'Hawaii')) 
              { }
 else             
    {$this->globals('ecom.ship_freehandled',1);}
    
$this->globals('ecom.customship_response',$custom);

?>

Laurie Stephens




Offline

 

Board footer