|
<<prev |
1 |
2 |
3 |
4 |
5 |
next>>
FREE Shipping based on Order Total - Method 3
This variation of our jsship.snp file will make the first (default) shipping method FREE if the order totals $100 or more. The second method will also be FREE if the order totals $200 ore more. This is handy if you offer Priority Mail or Parcel Post as your default shipping method but also offer FedEx, UPS 2nd day as a second method and wish to offer FREE overnight shipping for orders over $200 (or whatever total you desire) and giving FREE Priority Mail (or other method) on orders that total $100 or more.
All of the modifications described on the previous page are used as well as additional lines of code as described below:
The lines of code we added before are as follows:
// RealCartUniversity FREE Shipping if order is
// over $100.00 added following 8 lines
// This changes first shipping method only!
if((nOrderTtl >= 100) && (nIndex == 0)) // 1st method only
{
nShipCharge = 0.00;
return nShipCharge;
}
// end RealCartUniversity FREE shipping routine #2.
This time we are going to use two if statements to achieve our FREE shipping structure. To force RealCart to make only the default method of shipping FREE for orders $100 or more but less than $200 AND force RealCart to make both the default and the second method of shipping FREE for orders that total $200 or more.
The original modification is shown below in navy while the new version of the if statement is shown in bright blue.
function GetShippingCharge(nIndex)
{
// RealCartUniversity FREE Shipping if order is
// over $100.00 added following 8 lines
// This changes first shipping method only!
if((nOrderTtl >= 100) && (nIndex == 0)) // 1st method only
{
nShipCharge = 0.00;
return nShipCharge;
}
// end RealCartUniversity FREE shipping routine #2.
// make a copy so value doesn't change in calling function.
var nIdx = nIndex;
// Assign values of selected shipType object to
// variable for easier readability.
var nID = shipOption[nIndex].ID;
var nType = shipOption[nIndex].Type;
var nShipCharge = 0;
var nMatchVal = 0;
var bFound = false;
var nLastIndex = -1;
Here is the new code that achieves the dual levels of FREE shipping:
function GetShippingCharge(nIndex)
{
// RealCartUniversity FREE Shipping if order is
// over $100.00 or $200.00 added following 15 lines
// This changes both shipping methods independently!
if((nOrderTtl >= 200) && (nIndex ==1)) // 2nd method only
{
nShipCharge = 0.00;
return nShipCharge;
}
else
if((nOrderTtl >= 100) && (nIndex ==0)) // 1st method only
{
nShipCharge = 0.00;
return nShipCharge;
}
// end RealCartUniversity FREE shipping routine #3.
// make a copy so value doesn't change in calling function.
var nIdx = nIndex;
// Assign values of selected shipType object to
// variable for easier readability.
var nID = shipOption[nIndex].ID;
var nType = shipOption[nIndex].Type;
var nShipCharge = 0;
var nMatchVal = 0;
var bFound = false;
var nLastIndex = -1;
Since some of the lines of code displayed above may wrap due to the length of the lines and your current font size setting please view this file to see which lines are to remain intact without wrapping. To see the entire modified jsship.snp file please click here. The changes are highlighted with red type. You may download this modified jsship3.zip file, extract it and then save the new jsship.snp file to your current theme folder called jsship.snp. Rebuild Checkout, republish and enjoy.
On orders LESS than $100.00 your shipping pull-down menu on your checkout page will resemble this:
Select shipping:
On orders MORE than $100.00 but LESS than $200 your shipping pull-down menu on your checkout page will resemble this:
Select shipping:
On orders MORE than $200.00 your shipping pull-down menu on your checkout page will resemble this:
Select shipping:
Feel free to experiment with this function. You can always start over by re-cloning the original jsship.snp and starting over.
The next page shows how to add an optional message to the shopper to let them know their order qualifies for FREE shipping.
<<prev |
1 |
2 |
3 |
4 |
5 |
next>>
|