Umbraco Commerce
CMSCloudHeartcoreDXP
13.latest (LTS)
13.latest (LTS)
  • Umbraco Commerce Documentation
  • Release Notes
    • v13.1.0-RC
  • Commerce Products
    • Commerce Packages
    • Commerce Payment Providers
    • Commerce Shipping Providers
  • Installation
    • Installing Umbraco Commerce
    • Licensing
  • Upgrading
    • Upgrading Umbraco Commerce
    • Version Specific Upgrade Notes
    • Migrate from Vendr to Umbraco Commerce
      • Migrate Umbraco Commerce Checkout
      • Migrate custom Payment Providers
  • Getting Started
    • Introduction
    • Umbraco Configuration
    • User Interface
  • How-To Guides
    • Overview
    • Configure SQLite support
    • Limit Order Line Quantity
    • Use an Alternative Database for Umbraco Commerce Tables
    • Add item to Cart
    • Update Cart
    • Delete item in Cart
    • Customizing Templates
  • Key Concepts
    • Get to know the main features
    • Base Currency
    • Bulk Actions
    • Calculators
    • Dependency Injection
    • Discount Rules / Rewards
    • Events
      • List of validation events
      • List of notification events
    • Fluent API
    • Order Calculation State
    • Payment Forms
    • Payment Providers
    • Pipelines
    • Price/Amount Adjustments
    • Price Freezing
    • Product Adapters
    • Product Bundles
    • Product Variants
      • Complex Variants
    • Properties
    • ReadOnly and Writable Entities
    • Search Specifications
    • Settings Objects
    • Shipping Package Factories
    • Shipping Providers
    • Shipping Range/Rate Providers
    • Tax Sources
    • UI Config Files
    • Umbraco Properties
    • Unit of Work
    • Umbraco Commerce Builder
    • Webhooks
  • Tutorials
    • Overview
  • Reference
    • Stores
    • Shipping
      • Fixed Rate Shipping
      • Dynamic Rate Shipping
      • Realtime Rate Shipping
    • Storefront API
      • Endpoints
        • Order
        • Checkout
        • Product
        • Customer
        • Store
        • Currency
        • Country
        • Payment method
        • Shipping method
        • Content
    • Go behind the scenes
Powered by GitBook
On this page
  • Example Shipping Provider
  • Shipping Provider Responsibilities
  • Realtime Rates

Was this helpful?

Edit on GitHub
Export as PDF
  1. Key Concepts

Shipping Providers

Realtime shipping features via Shipping Providers in Umbraco Commerce.

Shipping Providers are how Umbraco Commerce can perform real-time shipping operations. Their job is to provide a standard interface between third-party shipping operators and Umbraco Commerce. This is done to allow the passing of information between the two platforms.

How the integrations work is often different for each shipping operator. The Umbraco Commerce Shipping Providers add a flexible interface that should work with most shipping operators.

Example Shipping Provider

An example of a bare-bones Shipping Provider would look something like this:

[ShippingProvider("my-shipping-provider-alias", "My Shipping Provider Name", "My Shipping Provider Description")]
public class MyShippingProvider :  ShippingProviderBase<MyShippingProviderSettings>
{
    public MyShippingProvider(UmbracoCommerceContext umbracoCommerce)
        : base(umbracoCommerce)
    { }

    ...
}

public class MyShippingProviderSettings
{
    [ShippingProviderSetting(Name = "API Key", 
        Description = "The API key to the shipping operators API",
        SortOrder = 100)]
    public string ApiKey { get; set; }

    ...
}

All Shipping Providers inherit from a base class ShippingProviderBase<TSettings>. TSettings is the type of a Plain Old Class Object (POCO) model class representing the Shipping Provider's settings. The class must be decorated with ShippingProviderAttribute which defines the Shipping Providers alias, name and description, and can also specify an icon to be displayed in the Umbraco Commerce backoffice.

The settings class consists of a series of properties, each decorated with a ShippingProviderSettingAttribute defining a name, description, and possible angular editor view file. These will all be used to dynamically build an editor interface for the given settings in the backoffice.

Shipping Provider Responsibilities

The responsibilities of a Shipping Provider are:

  • Realtime Rates - Calculating shipping rate options for a given Order.

Realtime Rates

Real-time rates are returned by implementing the GetShippingRatesAsync method. To facilitate rate calculation, a ShippingProviderContext object is passed to this method providing useful, contextual information, including:

  • Order - The Order and its items to be shipped.

  • MeasurementSystem - The measurement system of the Store associated with the given Order.

  • Settings - The shipping provider settings are captured via the backoffice UI.

  • AdditionalData - A general dictionary store for any data that may need passing between methods.

  • HttpContext - A reference to the current HTTP context.

Implementors should use these details to pass to the 3rd party shipping operators API and retrieve the estimated shipping costs. These should then be returned to Umbraco Commerce as a ShippingRatesResult which contains a IEnumerable<ShippingRate> Rates property. A ShippingRate value for each carrier/service returned by the operator should be supplied. A ShippingRate consists of the following properties:

  • Option - A ShippingOption instance, which consists of an Id and Name property for the given shipping service.

  • PackageId - The ID of the package from the ShippingProviderContext that this rate is associated with.

  • Value - A Price value for this rate.

PreviousShipping Package FactoriesNextShipping Range/Rate Providers

Last updated 4 months ago

Was this helpful?

Packages - A list of packages that make up this shipment. Each package contains a reference of the order lines it contains, its overall dimensions and weight, and both sender and receiver address details. See the for more details on how these are created.

Shipping Package Factories documentation