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.
This action is subject to InventoryEntry min/max restrictions when applicable. For more information, see Quantity limits.
Example to create an instance using the builder pattern
CartChangeLineItemQuantityAction cartChangeLineItemQuantityAction = CartChangeLineItemQuantityAction.builder()
.quantity(0.3)
.build()
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringdiscriminator value for CartChangeLineItemQuantityAction -
Method Summary
Modifier and TypeMethodDescriptionbuilder()builder factory method for CartChangeLineItemQuantityActionbuilder(CartChangeLineItemQuantityAction template) create builder for CartChangeLineItemQuantityAction instancecopyDeep()deepCopy(CartChangeLineItemQuantityAction template) factory method to create a deep copy of CartChangeLineItemQuantityAction@Valid MoneyRequired when the Line Item usesExternalPriceLineItemPriceMode.@Valid ExternalLineItemTotalPriceSets the LineItempriceandtotalPriceto the given value when changing the quantity of a Line Item with theExternalTotalLineItemPriceMode.idof the LineItem to update.keyof the LineItem to update.@NotNull LongNew value to set.of()factory methodof(CartChangeLineItemQuantityAction template) factory method to create a shallow copy CartChangeLineItemQuantityActionvoidsetExternalPrice(Money externalPrice) Required when the Line Item usesExternalPriceLineItemPriceMode.voidsetExternalTotalPrice(ExternalLineItemTotalPrice externalTotalPrice) Sets the LineItempriceandtotalPriceto the given value when changing the quantity of a Line Item with theExternalTotalLineItemPriceMode.voidsetLineItemId(String lineItemId) idof the LineItem to update.voidsetLineItemKey(String lineItemKey) keyof the LineItem to update.voidsetQuantity(Long quantity) New value to set.static com.fasterxml.jackson.core.type.TypeReference<CartChangeLineItemQuantityAction>gives a TypeReference for usage with Jackson DataBinddefault <T> Taccessor map functionMethods inherited from interface com.commercetools.api.models.cart.CartUpdateAction
getAction, withCartUpdateActionMethods 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()idof the LineItem to update. EitherlineItemIdorlineItemKeyis required.- Returns:
- lineItemId
-
getLineItemKey
String getLineItemKey()keyof the LineItem to update. EitherlineItemIdorlineItemKeyis 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
ExternalPriceLineItemPriceMode. Sets the LineItempriceto the given value when changing the quantity of a Line Item.The LineItem price is updated as described in Line Item price selection.
To set the money value in high precision, use HighPrecisionMoneyDraft.
- Returns:
- externalPrice
-
getExternalTotalPrice
Sets the LineItem
priceandtotalPriceto the given value when changing the quantity of a Line Item with theExternalTotalLineItemPriceMode. IfexternalTotalPriceis not given and thepriceModeisExternalTotal, the external price is unset and thepriceModeis set toPlatform.- Returns:
- externalTotalPrice
-
setLineItemId
idof the LineItem to update. EitherlineItemIdorlineItemKeyis required.- Parameters:
lineItemId- value to be set
-
setLineItemKey
keyof the LineItem to update. EitherlineItemIdorlineItemKeyis 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
ExternalPriceLineItemPriceMode. Sets the LineItempriceto the given value when changing the quantity of a Line Item.The LineItem price is updated as described in Line Item price selection.
To set the money value in high precision, use HighPrecisionMoneyDraft.
- Parameters:
externalPrice- value to be set
-
setExternalTotalPrice
Sets the LineItem
priceandtotalPriceto the given value when changing the quantity of a Line Item with theExternalTotalLineItemPriceMode. IfexternalTotalPriceis not given and thepriceModeisExternalTotal, the external price is unset and thepriceModeis 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
-
copyDeep
CartChangeLineItemQuantityAction copyDeep()- Specified by:
copyDeepin interfaceCartUpdateAction
-
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
-