URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushp_general_purpose
Thread Number: 411
[ Go back to previous page ]

Original Message
"Free shipping question"

Posted by russomr [mike@eightfeet.com] on at 05:27 PM
I need to set up my ushop application to have free shipping if the state entered by the customer is AE (it is a military code). How can I place this condition? Any help is greatly appreciated. Thanks.

Table of contents

Messages in this discussion
"Configuring free shipping based on state"
Posted by Microburst Support Team [support@uburst.com] on at 08:30 PM
You can set up a shipping method calculation type to "Custom" and then modify the custom_shipping subroutine.
In your custom_shipping subroutine (found in the ushop.pl script), you could add some code as shown in this example to check the billing_state and then set the shipping cost to 0.0 if the billing state is AE (see the snippet of code added near the end of this subroutine):

#---------------------------------------------------------------------------
# Subroutine to perform a custom shipping calculation.
#---------------------------------------------------------------------------
sub custom_shipping
{
local ($shipping_table) = @_;
local ($ret_value);

# Reset the return value.
$ret_value = 0.0;

#---------------------------------------------------------
# Variables that may be useful in your custom calculation.
#---------------------------------------------------------

# The name of the currently selected shipping method.
$shipping_method = $shipping_method;

# The table/value of the currently selected shipping method.
$shipping_table = $shipping_table;

# The current billing state.
$billing_state = $billing_state;

# The current billing country.
$billing_country = $billing_country;

# The current billing zip code.
$billing_zip_code = $billing_zip_code;

# The current shipping state (if any).
$shipping_state = $shipping_state;

# The current shipping zip code (if any).
$shipping_zip_code = $shipping_zip_code;

# The current shipping country (if any).
$shipping_country = $shipping_country;

# The subtotal of the items in the shopping cart (before any discounts).
$totals_subtotal1 = $totals_subtotal1;

# The subtotal of the items in the shopping cart (after any discounts).
$totals_subtotal2 = $totals_subtotal2;

# The total weight of the items in the shopping cart.
$totals_total_weight = $totals_total_weight;

# The total quantity of items in the shopping cart.
$totals_total_quantity = $totals_total_quantity;

# The total of all/any shipping modifiers that were associated with each
# product in the cart. Typically, this $totals_shipping_modifier should
# just be ADDED to the total shipping charge, such as:
# $ret_value += $totals_shipping_modifier
$totals_shipping_modifier = $totals_shipping_modifier;

# NOTE: The $ret_value should be the desired shipping charge.

# check if shipping state is AE and set shipping cost to 0 if so
if ($shipping_state eq "AE")
{
$ret_value = 0.0;
}
else
{
$ret_value = 5.0; # whatever shipping value you want here
}

return ($ret_value);
}
# End of custom_shipping()



"RE: Configuring free shipping based on state"
Posted by Bill Weiner on at 07:54 AM
Another option to might be to just add a different Shipping Method that can be selected by Military Customers. Ie.

Standard Shipping
Overnight Shipping
AE Shipping

Of course this relies on the customer to choose the desired shipping.

The "custom_shipping" method described above will automate it for you.


"Not working"
Posted by russomr [mike@eightfeet.com] on at 00:39 AM
I placed the sample code in the UShop.pl file and it is not working. It is still charging for S&H. I really don't want the user to have to select the AE Shipping choice (option #2 you suggested). Any ideas on what I might be doing wrong when substituting this code in the file?

"Not working"
Posted by Microburst Support Team [support@uburst.com] on at 05:58 AM
Go ahead and fill out an official support request from this link
http://www.uburst.com/supportform.html
using your license, and give us the URL to your control panel and the password to log in.

If we can't spot the problem that way, we'll need you to e-mail us either your FTP information or your ushop.pl script.


"RE: Not working"
Posted by Bill Weiner on at 06:47 AM
Also, after making the modifications, did you remember to specify the "CUSTOM" shipping type when setting up the shipping options in the uShop Control Panel?