The code that follows can be found in the file called jsship.snp v2.0.7.1

    This is the default snippit located in "[Settings_AppDir]\Templates\Common" folder

    begin file jsship.snp - - - - - - - - - - - - - - - - - -

    Do NOT modify the RealCart Tags when editing this code or
    this snippit will not parse correctly. (It will not work anymore.)

    Shipping javaScript functions...
    */

// Shipping type constants. Javascript doesn't support const keyword or #define's so
// I've just declared them as variables with upper case notation.
var WEIGHT = 1;
var QUANTITY = 2;
var PRICE = 3;
var FLATRATE = 4;

shipCharge = new Array();
function shipChargeObject(a1, a2, a3, a4, a5)
{
    this.ID = a1;
    this.From = a2;
    this.To = a3;
    this.Charge = a4;
    this.Type = a5;
}

// The "IncludeAll" specifier along with the current record operator ";"
// indicates to loop through all the records in the table.
[ShippingChargesLoop_Begin;Records=IncludeAll]
shipCharge[[ShippingChargesLoop_Counter]] = new shipChargeObject([ShippingCharges_ShippingID],
                [ShippingCharges_From],
                [ShippingCharges_To],
                [ShippingCharges_ShippingCharge],
                [ShippingCharges_ShipType]);
[ShippingChargesLoop_End]

shipOption = new Array();
function shipOptionObject(a1, a2, a3, a4, a5)
{
    this.ID = a1;
    this.Type = a2;
    this.FlatRate = a3;
    this.HandlingFee = a4;
    this.Label = a5;
}

[ShippingTypesLoop_Begin;Records=IncludeAll]
shipOption[[ShippingTypesLoop_Counter]] = new shipOptionObject([ShippingTypes_ShippingID],
                [ShippingTypes_ShippingType],
                [ShippingTypes_FlatRate],
                [ShippingTypes_HandlingFee],
                "[ShippingTypes_ShippingLabel]");
[ShippingTypesLoop_End]

// Returns the charge for shipping based on
// the shipping type at a given index within
// shipping drop menu.
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;

    // alert("GetShippingCharge(" + nIdx + ")");
    
    // Based on the shipping type, determine the value
    // we need to match in the shipCharge array.
    if(!isFramed)
    {
        // alert("UnFramed");
        nMatchVal = 0;
    }
    else if(nType == WEIGHT)
    {
        nMatchVal = parent.app.document.cart.GetTotalWeight();
    }
    else if(nType == QUANTITY)
    {
        nMatchVal =    parent.app.document.cart.GetItemCount();
    }
    else if(nType == PRICE)
    {
        nMatchVal = parent.app.document.cart.GetTotal();
    }
    else
    {    
        nMatchVal = 0;
        nShipCharge = shipOption[nIndex].HandlingFee + shipOption[nIdx].FlatRate;
    }

    // Only update shipping if there is something to update.
    if(nMatchVal > 0)
    {
        // For each index (row) of the shipCharge array....
        var i;
        for(i = 0; i < shipCharge.length; i++)
        {
            // Look for only row's with the selected shipping ID.
            if(shipCharge[i].ID == nID)
            {
                // Remember the last found index should there not
                // be a match we just use the last (greatest) charge.
                nLastIndex = i;

                if(nMatchVal > shipCharge[i].From && nMatchVal <= shipCharge[i].To)
                {
                    bFound = true;
                    nShipCharge = shipCharge[i].Charge;
                    // alert(i + " " + nShipCharge);
                    // alert(nTotalShipCharge);
                    break;
                }
            }
        }

        // Didn't find a match in the array, use the last one.
        if(!bFound)
        {
            if(nLastIndex > -1)
            {
                // alert("Using last shipping charge");
                nShipCharge = shipCharge[nLastIndex].Charge;
            }
            else
            {
                nShipCharge = 0.00;
            }
        }
    }
    
    return nShipCharge;
}

function UpdateShipping(i)
{
    // make a copy so value doesn't change in calling function.
    var nIndex = i;

    if(isFramed)
    {
        var nHandlingFee = shipOption[nIndex].HandlingFee;
        var nShipCharge = GetShippingCharge(nIndex);
        var nTotalShipCharge = nShipCharge + nHandlingFee;

        // Remove any shipping that was added the the cart from
        // a previous selection.
        parent.app.document.cart.RemoveShipping();

        // alert("ship index = " + i);
        var strLabel = shipOption[nIndex].Label;
        var strTotalShipCharge = nTotalShipCharge.toString();

        // Finally, update the cart with the shipping charge.

        if(strTotalShipCharge != '0')
        {
            var strMsg = "Shipping charges have been added as follows: \n\n[Projects_CurrencySymbol] " + nShipCharge + " for \"" + strLabel + "\" shipping and \n[Projects_CurrencySymbol] " + nHandlingFee + " for a handling fee.\n\nThanks again";
        }
        else
        {
            var strMsg = "And thank you";
        }
        alert("Thank you for your order.\n\n" + strMsg + " for shopping [Projects_SiteName]!");
        parent.app.document.cart.UpdateShipping(strLabel, strTotalShipCharge);
        strShipInfo = strLabel + " shipping ([Projects_CurrencySymbol] " + strTotalShipCharge + ")";
    }
    else
    {
        alert('Shipping Choice made.');
    }
return strTotalShipCharge;
}

    /*
    end of file jsship.snp - - - - - - - - - - - - - - - - - -