getApplicableShippingMethods
Method fetching the applicable shipping methods for a certain shipment of a basket.
This method communicates with the getApplicableShippingMethods endpoint of the Vue Storefront API Middleware. In turn, it receives data from the getShippingMethodsForShipment or the Get applicable shipping methods for certain shipment of basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Signature
export declare function getApplicableShippingMethods(
props: ShipmentGetApplicableShippingMethodsParams & {
basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.ShippingMethodResult>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | ShipmentGetApplicableShippingMethodsParams & { basketId?: string; } | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a Basket object.
Referenced Types
ShipmentGetApplicableShippingMethodsParamsShopperBaskets.ShippingMethodResult
Examples
Fetching the applicable shipping methods for a certain shipment of a basket by shipmentId.
import { sdk } from '~/sdk.config.ts';
const basketId = (await sdk.commerce.getBasket()).basketId;
const updatedBasket = await sdk.commerce.getApplicableShippingMethods({ shipmentId: 'me', basketId });