getShippingRates( )


Retrieves shipping rates provided by a custom shipping rates plugin.

This function is automatically called by Wix eCommerce to retrieve the shipping rates provided by your plugin. This happens when actions are performed on the cart/checkout entities/pages and/or when there is a change to any property in the options parameter. For example, when an item is added to the cart.

Notes:

  • Every time getShippingRates() is called, the response is cached. This cache is valid for 10 minutes and is used until a change is made to any property in the options parameter, at which point the cache is refreshed.
  • If your plugin fails to respond within 10 seconds, the call will purposefully fail to ensure a smooth user experience. We recommend optimizing your logic: calls to external APIs take longer and are outside our control; use fewer wixData actions when possible.

Where to find getShippingRates()

When you add the Shipping Rates service plugin, a folder is automatically added to your site. Use the .js file in the folder to write your custom shipping rates code.

For more information on customizing your shipping rate options, see Tutorial: Shipping Rates Service Plugin.

Method Declaration
Copy
Method Parameters
optionsOptionsRequired

Shipping origin, shipping destination, and general configurations.


contextContextRequired

Metadata about the request.

Returns
Return Type:Promise<ShippingRates>
Did this help?