Enable fallback shipping methods

You can designate internal shipping methods as fallback by selecting the fallback option.

You can also designate externally priced shipping methods as fallback. If the shipping calculator fails (no response or invalid response), then any internal and externally priced shipping methods that are eligible based on internal rules are shown to the shopper. In this case, the internal prices defined in the shipping methods will be used.

Keep in mind that internal shipping methods marked as fallback are only available to the shopper if the shipping calculator fails. Externally priced shipping methods can be available to the shopper if the shipping calculator fails (using internal prices) or if the shipping method is available based on internal rules and is returned by the shipping calculator (as identified by an ID). In case of the latter, the price and properties returned by the shipping calculator will be used.

Understand more about fallback shipping methods

As mentioned, Oracle Commerce lets you offer fallback shipping methods to shoppers when it cannot connect to your external shipping calculator’s web service, for example, in the event of an outage. The fallback logic displays internally priced shipping methods (that you can specify either in the administration interface or with the Admin API) to all orders if a specified number of service calls to the external shipping calculator fail within a specified time span. This prevents errors at the shipping calculation step of order processing and allows orders to progress to the payment processing step.

During the initial configuration of your environment, Oracle sets certain settings that trigger the use of fallback shipping methods, including the number of consecutive failed service calls, the time span over which to count failed service calls, and the time period after which Commerce should try calling the shipping calculator’s service again.

Commerce uses the fallback logic to calculate shipping only when calls to the external shipping calculator fail. That is, when the external shipping calculator’s web service responds to a call with a 500-level status code. Fallback shipping calculation is not used when any other type of response is received.

The shippingMethod property on Commerce order objects specifies the shipping method selected by the shopper when they created the order. This property is also included in the data Commerce sends in the Order Submit webhook. You can use this information to identify orders submitted with a fallback shipping method so you can decide how to handle them in your order management system.

Specify a fallback shipping method

You can mark any number of internally priced shipping methods as fallbacks. You might want to create a fallback method for each type of shipping method you expected to receive back from the external shipping service. This section describes how to use the Admin REST API to specify fallback shipping methods. To learn how to use the administration interface for this task, see Configure Shipping.

To specify that a shipping method can be used as a fallback, set its isFallback property to true. The following example marks an existing shipping method as a fallback.

PUT /ccadmin/v1/shippingMethods/standardShippingMethod HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>

{
  "isFallback": true
}

Disable fallback shipping

The ability to use fallback shipping methods is enabled by default, but you can disable it. If you disable fallback shipping and Commerce cannot reach your shipping calculator’s web service, shoppers may see errors during checkout and may not be able to complete their orders.

You use the Commerce Admin API to set the fallbackEnabled property, a Boolean that specifies whether fallback shipping methods are used. The default value for fallbackEnabled is true.

To set the fallbackEnabled property, issue a PUT request to the /ccadmin/v1/merchant/fallbackShippingConfiguration endpoint.

The following example shows a PUT request that disables fallback shipping.

PUT /ccadmin/v1/merchant/fallbackShippingConfiguration HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>

{
   "fallbackEnabled": false
}