Interface CartChangeLineItemQuantityAction
- All Superinterfaces:
CartUpdateAction
,ResourceUpdateAction<CartUpdateAction>
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 update action in a single Cart update command.
The LineItem price is set as described in Line Item price selection.
Example to create an instance using the builder pattern
CartChangeLineItemQuantityAction cartChangeLineItemQuantityAction = CartChangeLineItemQuantityAction.builder()
.quantity(0.3)
.build()
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
discriminator value for CartChangeLineItemQuantityAction -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
builder factory method for CartChangeLineItemQuantityActionbuilder
(CartChangeLineItemQuantityAction template) create builder for CartChangeLineItemQuantityAction instancedeepCopy
(CartChangeLineItemQuantityAction template) factory method to create a deep copy of CartChangeLineItemQuantityAction@Valid Money
Required when the Line Item usesExternalPrice
LineItemPriceMode.@Valid ExternalLineItemTotalPrice
Sets the LineItemprice
andtotalPrice
to the given value when changing the quantity of a Line Item with theExternalTotal
LineItemPriceMode.id
of the LineItem to update.key
of the LineItem to update.@NotNull Long
New value to set.of()
factory methodof
(CartChangeLineItemQuantityAction template) factory method to create a shallow copy CartChangeLineItemQuantityActionvoid
setExternalPrice
(Money externalPrice) Required when the Line Item usesExternalPrice
LineItemPriceMode.void
setExternalTotalPrice
(ExternalLineItemTotalPrice externalTotalPrice) Sets the LineItemprice
andtotalPrice
to the given value when changing the quantity of a Line Item with theExternalTotal
LineItemPriceMode.void
setLineItemId
(String lineItemId) id
of the LineItem to update.void
setLineItemKey
(String lineItemKey) key
of the LineItem to update.void
setQuantity
(Long quantity) New value to set.static com.fasterxml.jackson.core.type.TypeReference<CartChangeLineItemQuantityAction>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
accessor map functionMethods inherited from interface com.commercetools.api.models.cart.CartUpdateAction
getAction, withCartUpdateAction
Methods inherited from interface com.commercetools.api.models.ResourceUpdateAction
get
-
Field Details
-
CHANGE_LINE_ITEM_QUANTITY
discriminator value for CartChangeLineItemQuantityAction- See Also:
-
-
Method Details
-
getLineItemId
String getLineItemId()id
of the LineItem to update. EitherlineItemId
orlineItemKey
is required.- Returns:
- lineItemId
-
getLineItemKey
String getLineItemKey()key
of the LineItem to update. EitherlineItemId
orlineItemKey
is required.- Returns:
- lineItemKey
-
getQuantity
New value to set.
If
0
, the Line Item is removed from the Cart.- Returns:
- quantity
-
getExternalPrice
Required when the Line Item uses
ExternalPrice
LineItemPriceMode. Sets the LineItemprice
to the given value when changing the quantity of a Line Item.The LineItem price is updated as described in Line Item price selection.
- Returns:
- externalPrice
-
getExternalTotalPrice
Sets the LineItem
price
andtotalPrice
to the given value when changing the quantity of a Line Item with theExternalTotal
LineItemPriceMode. IfexternalTotalPrice
is not given and thepriceMode
isExternalTotal
, the external price is unset and thepriceMode
is set toPlatform
.- Returns:
- externalTotalPrice
-
setLineItemId
id
of the LineItem to update. EitherlineItemId
orlineItemKey
is required.- Parameters:
lineItemId
- value to be set
-
setLineItemKey
key
of the LineItem to update. EitherlineItemId
orlineItemKey
is required.- Parameters:
lineItemKey
- value to be set
-
setQuantity
New value to set.
If
0
, the Line Item is removed from the Cart.- Parameters:
quantity
- value to be set
-
setExternalPrice
Required when the Line Item uses
ExternalPrice
LineItemPriceMode. Sets the LineItemprice
to the given value when changing the quantity of a Line Item.The LineItem price is updated as described in Line Item price selection.
- Parameters:
externalPrice
- value to be set
-
setExternalTotalPrice
Sets the LineItem
price
andtotalPrice
to the given value when changing the quantity of a Line Item with theExternalTotal
LineItemPriceMode. IfexternalTotalPrice
is not given and thepriceMode
isExternalTotal
, the external price is unset and thepriceMode
is set toPlatform
.- Parameters:
externalTotalPrice
- value to be set
-
of
factory method- Returns:
- instance of CartChangeLineItemQuantityAction
-
of
factory method to create a shallow copy CartChangeLineItemQuantityAction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
@Nullable static CartChangeLineItemQuantityAction deepCopy(@Nullable CartChangeLineItemQuantityAction template) factory method to create a deep copy of CartChangeLineItemQuantityAction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CartChangeLineItemQuantityAction- Returns:
- builder
-
builder
create builder for CartChangeLineItemQuantityAction instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCartChangeLineItemQuantityAction
default <T> T withCartChangeLineItemQuantityAction(Function<CartChangeLineItemQuantityAction, T> helper) accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
static com.fasterxml.jackson.core.type.TypeReference<CartChangeLineItemQuantityAction> typeReference()gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-