Interface MyCartChangeLineItemQuantityAction
- All Superinterfaces:
MyCartUpdateAction,ResourceUpdateAction<MyCartUpdateAction>
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.
When the action applies to LineItems with ExternalTotal 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.
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
MyCartChangeLineItemQuantityAction myCartChangeLineItemQuantityAction = MyCartChangeLineItemQuantityAction.builder()
.quantity(0.3)
.build()
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringdiscriminator value for MyCartChangeLineItemQuantityAction -
Method Summary
Modifier and TypeMethodDescriptionbuilder()builder factory method for MyCartChangeLineItemQuantityActionbuilder(MyCartChangeLineItemQuantityAction template) create builder for MyCartChangeLineItemQuantityAction instancecopyDeep()deepCopy(MyCartChangeLineItemQuantityAction template) factory method to create a deep copy of MyCartChangeLineItemQuantityActionidof the LineItem to update.keyof the LineItem to update.@NotNull LongNew value to set.of()factory methodof(MyCartChangeLineItemQuantityAction template) factory method to create a shallow copy MyCartChangeLineItemQuantityActionvoidsetLineItemId(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<MyCartChangeLineItemQuantityAction>gives a TypeReference for usage with Jackson DataBinddefault <T> Taccessor map functionMethods inherited from interface com.commercetools.api.models.me.MyCartUpdateAction
getAction, withMyCartUpdateActionMethods inherited from interface com.commercetools.api.models.ResourceUpdateAction
get
-
Field Details
-
CHANGE_LINE_ITEM_QUANTITY
discriminator value for MyCartChangeLineItemQuantityAction- 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
-
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
-
of
factory method- Returns:
- instance of MyCartChangeLineItemQuantityAction
-
of
factory method to create a shallow copy MyCartChangeLineItemQuantityAction- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
MyCartChangeLineItemQuantityAction copyDeep()- Specified by:
copyDeepin interfaceMyCartUpdateAction
-
deepCopy
@Nullable static MyCartChangeLineItemQuantityAction deepCopy(@Nullable MyCartChangeLineItemQuantityAction template) factory method to create a deep copy of MyCartChangeLineItemQuantityAction- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for MyCartChangeLineItemQuantityAction- Returns:
- builder
-
builder
static MyCartChangeLineItemQuantityActionBuilder builder(MyCartChangeLineItemQuantityAction template) create builder for MyCartChangeLineItemQuantityAction instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withMyCartChangeLineItemQuantityAction
default <T> T withMyCartChangeLineItemQuantityAction(Function<MyCartChangeLineItemQuantityAction, 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<MyCartChangeLineItemQuantityAction> typeReference()gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-