# Configure Digital River shipping options

Use the integrated Digital River’s [Global Logistics](https://docs.digitalriver.com/digital-river-api/using-our-services/global-logistics) (shipping options) feature with this extension. You can configure the extension to let shoppers select from shipping options that provide cross-border shipping through Digital River global logistics providers.

## Shipping options best practices

Keep in mind the following when configuring and using Digital River shipping options:

* You cannot apply native SFCC shipping promotions to only specific Digital River shipping options. Digital River shipping options use a single default SFCC (Salesforce Commerce Cloud) shipping method per currency on the backend. Therefore, you can only apply native SFCC shipping promotions to all Digital River Shipping methods in a specific currency. Use the [<mark style="background-color:red;">`modifyShippingQuotes`</mark>](#customizing-shipping-options-with-the-modifyshippingquotes-function) function to adjust pricing on specific shipping methods.
  * Use the DR Shipping Options - Free Shipping Option[ custom site preference](https://docs.digitalriver.com/salesforce-b2c-link-cartridge/salesforce-b2c-link-cartridge-3.1/configure-the-salesforce-b2c-link-cartridge/..#custom-site-preferences) to offer free shipping on a single shipping option or more than one shipping option (Digital River Shipping Option).  \
    **Note**: This is not a native SFCC promotion and cannot be applied with a promo code. It is a simplified way to offer free shipping on specific shipping options.
* The merchant must ensure that when using the Digital River shipping options in Native or Both modes, there exists a [valid SFCC default native shipping method](https://docs.digitalriver.com/salesforce-b2c-link-cartridge/salesforce-b2c-link-cartridge-3.1/configure-the-salesforce-b2c-link-cartridge/..#update-shipping-methods-to-support-digital-river-shipping-options) for any address per currency. Otherwise, SFRA (Storefront Reference Architecture) will not function properly.
* When Digital River shipping options are enabled, the user cannot select shipping methods on the Cart show page. This occurs because shipping options rely on complete address data not yet on the Cart page.
* Digital River shipping options do not apply to digital products. If the shopper has put only digital products in their basket, the Digital River shipping options are not displayed, and native methods are used instead.

## Configuring Digital River shipping options

Complete the following steps to configure Digital River shipping options:

### 1. Configure the shipping option site preference

Configure one site preference (set it at site level) when using Digital River Shipping Options. Choose from the following available options:

* Native SFCC methods only (native): Choose this option to turn off the Digital River Shipping Options feature and display only native SFCC shipping methods.
* DR Shipping Quotes methods only (quotes): Choose this option to display only Digital River Shipping Options.
* Native SFCC and DR Shipping Quotes methods (both): Choose this option to display both Digital River shipping options and native SFCC shipping methods.\ <br>

  <figure><img src="https://content.gitbook.com/content/WGEZ726cqX4qj6461etU/blobs/ZPeIVFO7RUBmziCctuie/image.png" alt=""><figcaption></figcaption></figure>

### 2. Create the shipping option method

When using shipping options, the merchant must also create a shipping method named `DRDefaultShpXXX` where `XXX` is the uppercase ISO currency code for each currency used on the site. See [Update shipping methods to support Digital River shipping options](https://docs.digitalriver.com/salesforce-b2c-link-cartridge/salesforce-b2c-link-cartridge-3.1/configure-the-salesforce-b2c-link-cartridge/..#update-shipping-methods-to-support-digital-river-shipping-options).

### 3. Enable the custom cache

Natively, SFRA makes frequent calls to update available shipping methods. To optimize performance when using the Digital River Shipping Options feature, you can enable the custom cache provided by the cartridge. Enable the custom cache by going to **BM Administration> Operations> Custom Caches**.

### 4. Assign each product a SKU group

&#x20;The Digital River global logistics feature requires that each product have a `sku-group` configured. Work with your project manager to identify `sku-groups` for your products and [assign them in the business manager](https://docs.digitalriver.com/salesforce-b2c-link-cartridge/salesforce-b2c-link-cartridge-3.1/user-guide#product-management).

### 5. Override the isAllowedEndpoint function

The Digital River cartridge extends the ShippingModel, which is called each time the OrderModel is created. If your checkout pages use the OrderModel object in any controller endpoints, override the isAllowedEndpoint function in `int_digitalriver/cartridge/scripts/digitalRiver/drCheckoutHelper.js` to include your controller endpoint.

By default, this function allows the following endpoints:

<figure><img src="https://content.gitbook.com/content/WGEZ726cqX4qj6461etU/blobs/4rVuybvYpmaVoOCG0fwN/image.png" alt=""><figcaption></figcaption></figure>

## Customizing shipping options with the modifyShippingQuotes function

Use the `modifyShippingQuotes` function in the `drShippingQuotesHelper` script to modify the Digital River Shipping Options before being presented to the shopper. For example, you can filter the array of shipping options to display only those using DDP (or DAP) shipping terms. You can also modify the `shippingCost` to offer the shopper a discount on shipping costs.&#x20;

Find the script at the following location:

`int_digitalriver\cartridge\scripts\digitalRiver\drShippingQuotesHelper.js`

**Note:** You should override the `modifyShippingQuotes` function in a custom cartridge.

In this script, the `quotes` parameter in the `modifyShippingQuotes`function contains an array of shipping quotes provided by Digital River. This array is structured the same as the `filteredMethods` array in the SFRA `getApplicableShippingMethods` function.

<figure><img src="https://content.gitbook.com/content/WGEZ726cqX4qj6461etU/blobs/DGEX1CxAo9Fa41uMgxJA/image.png" alt=""><figcaption></figcaption></figure>

While you have control to modify any element of the array, you should limit your changes to filtering shipping options (removing any shipping options that should not be displayed to the shopper) and changing the `shippingCost`of a shipping option (for example, offering free shipping for a particular shipping option).
