To create a custom shipping carrier provider class, you must perform the following:
The GetServiceRates method accepts one argument. It is of type Telerik.Sitefinity.Ecommerce.Shipping.Model.IShippingRequest. It has the following members:
In this method you have to get a collection of the available shipping service for your provider. To do this you must perform the following:
Here is a sample code, outlining the steps:
CustomShippingCarrierProvider : IShippingCarrierProvider
IShippingRequest _shippingData =
ShippingCarrierProviderSettings _carrierSettings =
ShippingResponseContext GetServiceRates(IShippingRequest shippingData)
_shippingData = shippingData;
// Get an instance of the ShippingManager class.
ShippingManager manager =
// Retrieve the shipping provider's settings
_carrierSettings = manager.GetShippingCarrierSetting(Name);
"Custom Shipping Provider settings not found"
// _carrierSettings will contain the settings you entered in the administration backend for
// your custom shipping provider: Url, Username, Password, AccountNumber, LicenseKey, and Timeout.
// You can use one or more of these values to communicate with an external shipping provider.
// At this time these are the only fields available for holding shipping provider data. If you require
// additional data for your particular provider, you could hardcode that data in this class or
// you might consider concatenating that data with other data in one of the existing carrier settings
// properties and parsing the data values as needed.
// _shippingData holds all of the shopping cart and store configuration data available to you to use
// in your shipping calculation (or to pass to an external service).
// You can loop through the _shippingData.CartOrder.Details records to retrieve each product in the
// cart to get important shipping information such as the quantity ordered and the weight of each product.
// For example:
// foreach (var detail in shippingData.CartOrder.Details)
// if (detail.IsShippable == true)
// double weight = (int)Math.Ceiling(detail.Weight * detail.Quantity);
// Calculate your shipping here (or call your external service).
// Create an instance of the ShippingResponseObject class to return from the method.
ShippingResponseContext shippingResponseContext =
// Get the services of the shipping carrier. Depending on the shipping carrier this can be done via its external service (if available).
// Populate the instance of ShippingResponseContext class with
// a list of IShippingResponse objects representing the services that this shipping
// carrier supports (e.g. "First Class", "OverNight", "2 Day", etc). Populate the ErrrorMessage property
// with an error message if necessary.
// For each service, create and populate an instance of the GenericShippingResponse object, populate the class,
// and add that instance to your ShippingResponseContext object's ShippingResponses List.
// For example:
// GenericShippingResponse shippingResponse = new GenericShippingResponse();
// shippingResponse.ServiceCode = serviceCode; // e.g "FIRSTCLASS", "OVERNIGHT", "2DAY"
// shippingResponse.ServiceName = "name"; // full name of the service "First Class", "Overnight", "Two Day Mail".
// shippingResponse.ShippingCarrierName = "USPS"; // Carrier name (e.g. "UPS", "FEDEX", "USPS")
// shippingResponse.ShippingServiceName = serviceCode;
// shippingResponse.SortOrder = 1; // (optional) Display sort order (1,2,3...)
// shippingResponse.ServicePrice = price; // Cost of the service (service's price)
Back To Top