Reference Experience

Add a conversational interface to the Elastic Path platform by implementing this reference experience of an Amazon Lex chatbot. Learn how to integrate the Reference Chatbot with the React PWA Reference Storefront.

Shipping Calculation Options

Shipping Calculation Options

Overview

Elastic Path provides two shipping options to the user, priced shipping options and
unpriced shipping options. The implementations of
ShippingOptionService and
PricingSnapshotService call the
ShippingCalculationService classes. Both services return a
ShippingOptionResult object, which contains a list of
ShippingOption objects. Each ShippingOption
object represents a shipping provider, such as FedEx, which is available for the
order. The following diagram illustrates the workflow for unpriced shipping options
and priced shipping options:

Unpriced Shipping Options

Unpriced shipping options provide the details of the available shipping options.
Unpriced shipping options are returned when a user does not provide an address to
ship the order, or if the shipping prices cannot be calculated before placing an
order. For example, an unregistered user or incomplete purchase workflow.

Work Flow

Cortex calls the ShippingOptionService class. The
ShippingOptionService class is the high-level API that
takes Commerce Engine domain objects, such as ShoppingCart
and Address.

The ShippingOptionService class calls one of the
following:

CachingShippingCalculationService: If
ShippingOptionService call is already made for
the same shopping cart with the same details,
CachingShippingCalculationService returns the
cached shipping cost, ShippingOptionResult.

ShippingCalculationService: For a new cart, the
request is passed to this service to get the shipping cost. The
ShippingCalculationService uses Data Transfer
Objects (DTO) to decouple the underlying calculation from the
Commerce Engine.

This request returns the
available shipping options even if the shipping address and cart details
are not provided.

The shipping calculation plug-in returns the shipping cost to Cortex.

Priced Shipping Options

Priced shipping options are provided to a
user before completing payment for an order to calculate total price of the order.
Priced shipping options are available only if the customer provides the shipping
address when completing the order. The PricingSnapshotService
examines the shopping cart and returns the pricing details of the shopping
cart.