removeShipment
Removes a specified shipment and all associated product, gift certificate, shipping, and price adjustment line items from a basket. It is not allowed to remove the default shipment.
This method communicates with the removeShipment endpoint of the Vue Storefront API Middleware. In turn, it receives data from the removeShipment or the Remove shipment from basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Possible Responses
400 - InvalidShipmentIdException - Indicates that the given shipment id is invalid. - InvalidCustomerException - Indicates that the customer assigned to the basket does not match the verified customer represented by the JWT, not relevant when using OAuth.
403 | DefaultShipmentDeletionForbiddenException - Indicates that the given shipment id corresponds to the default shipment (shipment ID always set to "me") and cannot be removed.
Signature
export declare function removeShipment(
props: ShipmentRemoveParams & {
basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.Basket>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | ShipmentRemoveParams & { 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
ShipmentRemoveParamsShopperBaskets.Basket
Examples
Removing a shipment by shipmentId.
import { sdk } from '~/sdk.config.ts';
const basket = await sdk.commerce.removeShipment({ shipmentId: 'shipmentId', basketId: 'testBasketId' });