When multiple shipping addresses are set for a Line Item, use the Remove LineItem and Add LineItem update action to change the shipping details. Since it is not possible for the API to infer how the overall change in the Line Item quantity should be distributed over the sub-quantities, the shippingDetails field is kept in its current state to avoid data loss.

To change the Line Item quantity and shipping details together,
use this update action in combination with the [Set LineItem ShippingDetails](ctp:api:type:CartSetLineItemShippingDetailsAction) update action
in a single Cart update command.

When the action applies to [LineItems](ctp:api:type:LineItem) with `ExternalTotal` [LineItemPriceMode](ctp:api:type:LineItemPriceMode),
it will be changed to `ExternalPrice` and the existing `externalPrice` value, i.e. `LineItem.price`, will be retained.
The LineItem total will be calculated by the system instead, so that the `externalTotalPrice` will be dropped.
interface MyCartChangeLineItemQuantityAction {
    action: "changeLineItemQuantity";
    lineItemId?: string;
    lineItemKey?: string;
    quantity: number;
}

Properties

action: "changeLineItemQuantity"
lineItemId?: string

id of the LineItem to update. Either lineItemId or lineItemKey is required.

lineItemKey?: string

key of the LineItem to update. Either lineItemId or lineItemKey is required.

quantity: number

New value to set.

If `0`, the Line Item is removed from the Cart.