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 09-14-2017 10:07:36

gfrracing
Member
Registered: 07-03-2010
Posts: 72
Website

Setting USPS for Free Shipping in United States Only

Nick on the USPS API can we get it to only Give free shipping for United States only in the Update ?

Or some how to Set it to were Free Shipping to only Country's ?

Thanks, Gary

Offline

 

#2 09-15-2017 08:23:45

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

Re: Setting USPS for Free Shipping in United States Only

Are all your items using USPS?


Nick Hendler

Offline

 

#3 09-15-2017 12:49:30

gfrracing
Member
Registered: 07-03-2010
Posts: 72
Website

Re: Setting USPS for Free Shipping in United States Only

yes

Offline

 

#4 09-18-2017 07:22:03

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

Re: Setting USPS for Free Shipping in United States Only

First, Store / Shipping / Custom Shipping Methods use to create a custom shipping script.  For the script's identifier, you can use anything you like, but we'll use 'uspscustom' here.  Enter 'USPS Custom' for the Display Name, and the following for the Shipping Method PHP Content:

Code:

<?php 

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

if (($info['country'] == 'United States') && ($info['total'] >= $freeshipamt) && ($freeshipamt > 0)) {

     $custom = array('Free US Shipping' => 0);

} else {

     $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',
                      'shiptype'      => 'R');

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

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

} // End of if statement.

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

$this->globals('ecom.ship_freehandled',1);

?>

Next, you need to assign all your inventory items to this script, you said they they were using USPS via Realtime currently.  You want every inventory item under Store / Inventory / Inventory Items to use 'USPS Custom' for it's 'Custom Shipping: Method' under the Delivery - Custom tab, and you'll want every one of those items to use a 'Delivery Method' of Custom Shipping under the Delivery - Config tab.  You can do this one-by-one using the management interface, or access System / Database / Raw Database Admin and choose to Submit a Raw SQL Statement to update all items at once.  Here is the statement to submit:

Code:

UPDATE ecom_inventory SET delmethod='C', customship='uspscustom'

Note: This updates all inventory items, be careful only to do this if you mean it.  Finally, you'll want to empty your shopping cart to removed cached shipping info in it that may be there, then add a few fresh items to your cart and test.  The only other thing to mention is the above script uses the 'Free Shipping: Threshold' setting under Store / Component / Settings / Shipping Settings, so you can increase the amount or turn this feature off from there.


Nick Hendler

Offline

 

#5 09-18-2017 11:30:15

gfrracing
Member
Registered: 07-03-2010
Posts: 72
Website

Re: Setting USPS for Free Shipping in United States Only

Ok Thanks, Nick

Offline

 

#6 09-18-2017 14:59:06

gfrracing
Member
Registered: 07-03-2010
Posts: 72
Website

Re: Setting USPS for Free Shipping in United States Only

Nick  I set this up and testing a couple of products. In Store / Component / Settings / Shipping Settings. when I set Free Shipping: Threshold to 0.00 it is still giving Free Shipping ? I want to be able set Free Shipping: Threshold on a Dollar amount be able to turn it on and off.

Thanks, Gary

Last edited by gfrracing (09-18-2017 15:01:05)

Offline

 

#7 09-18-2017 23:26:01

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

Re: Setting USPS for Free Shipping in United States Only

I edited the custom script above.  Please copy it again and try it.  Now it checks to be sure the free shipping amount is greater than zero before triggering free shipping.


Nick Hendler

Offline

 

Board footer