public interface Cart extends CartLike<Cart>
A shopping cart holds product variants and can be ordered.
Each cart either belongs to a registered customer or is an anonymous cart (getCustomerId() yields null).
A cart can have custom fields.
| Modifier and Type | Method and Description |
|---|---|
String |
getAnonymousId()
Identifies carts and orders belonging to an anonymous session (the customer has not signed up/in yet).
|
Address |
getBillingAddress()
Address for the bill.
|
CartState |
getCartState()
State in the perspective if the cart is active, merged with another cart or ordered.
|
com.neovisionaries.i18n.CountryCode |
getCountry() |
CustomFields |
getCustom() |
String |
getCustomerEmail()
The email of the customer which should be used for this cart/order.
|
Reference<CustomerGroup> |
getCustomerGroup()
In the order context the customer group can only be expanded if the customer was in a group before creating the order.
|
String |
getCustomerId()
The id of the customer possessing the cart.
|
List<CustomLineItem> |
getCustomLineItems()
The custom line items of this cart.
|
Integer |
getDeleteDaysAfterLastModification() |
List<DiscountCodeInfo> |
getDiscountCodes()
Discount codes belonging to this cart.
|
InventoryMode |
getInventoryMode() |
List<Address> |
getItemShippingAddresses() |
String |
getKey() |
List<LineItem> |
getLineItems()
Snapshots of the products added to the cart.
|
CartOrigin |
getOrigin() |
PaymentInfo |
getPaymentInfo()
Get associated payments.
|
List<Reference<CartDiscount>> |
getRefusedGifts()
The refused gifts of this cart.
|
Address |
getShippingAddress()
Address to ship the goods.
|
CartShippingInfo |
getShippingInfo()
Information about shipping set by the backend once the shipping method is set.
|
ShippingRateInput |
getShippingRateInput()
The shippingRateInput is used as an input to select a shipping rate price tier
|
KeyReference<Store> |
getStore() |
TaxCalculationMode |
getTaxCalculationMode()
Tax calculation mode of this cart.
|
TaxedPrice |
getTaxedPrice()
The taxed price.
|
javax.money.MonetaryAmount |
getTotalPrice() |
static Reference<Cart> |
referenceOfId(String id)
Creates a reference for one item of this class by a known ID.
|
static String |
referenceTypeId()
A type hint for references which resource type is linked in a reference.
|
static String |
resourceTypeId()
An identifier for this resource which supports
CustomFields. |
default Reference<Cart> |
toReference()
Creates a reference to this resource, the reference may not be filled.
|
static com.fasterxml.jackson.core.type.TypeReference<Cart> |
typeReference()
Creates a container which contains the full Java type information to deserialize this class from JSON.
|
calculateSubTotalPrice, calculateTotalAppliedTaxes, findCustomLineItem, findLineItem, getCurrency, getLocale, getTaxMode, getTaxRoundingModegetCreatedAt, getId, getLastModifiedAt, getVersionhasSameIdAs, toResourceIdentifierstatic String resourceTypeId()
CustomFields.TypeDraft.getResourceTypeIds(),
Customstatic String referenceTypeId()
Reference.getTypeId()static com.fasterxml.jackson.core.type.TypeReference<Cart> typeReference()
default Reference<Cart> toReference()
ReferenceabletoReference in interface Referenceable<Cart>toReference in interface Resource<Cart>@Nullable String getAnonymousId()
CartLikegetAnonymousId in interface CartLike<Cart>CartState getCartState()
CustomerSignInCommand,
OrderFromCartCreateCommandInventoryMode getInventoryMode()
@Nullable CartShippingInfo getShippingInfo()
CartLikegetShippingInfo in interface CartLike<Cart>SetShippingMethod,
SetCustomShippingMethod,
AddDelivery@Nullable Address getBillingAddress()
CartLikegetBillingAddress in interface CartLike<Cart>SetBillingAddress@Nullable com.neovisionaries.i18n.CountryCode getCountry()
getCountry in interface CartLike<Cart>@Nullable String getCustomerEmail()
CartLikeCustomer.getEmail().getCustomerEmail in interface CartLike<Cart>SetCustomerEmail@Nullable Reference<CustomerGroup> getCustomerGroup()
CartLikegetCustomerGroup in interface CartLike<Cart>@Nullable String getCustomerId()
getCustomerId in interface CartLike<Cart>CustomerSignInCommand,
SetCustomerIdList<CustomLineItem> getCustomLineItems()
getCustomLineItems in interface CartLike<Cart>AddCustomLineItem,
RemoveCustomLineItem,
Order.getCustomLineItems()List<LineItem> getLineItems()
CartLikegetLineItems in interface CartLike<Cart>AddLineItem,
ChangeLineItemQuantity,
RemoveLineItem@Nullable Address getShippingAddress()
CartLikegetShippingAddress in interface CartLike<Cart>SetShippingAddress,
CartLike.getTaxedPrice()@Nullable TaxedPrice getTaxedPrice()
CartLikeCartLike.getShippingAddress()) is used to determine tax rate of the line items.getTaxedPrice in interface CartLike<Cart>TaxCalculationMode getTaxCalculationMode()
CartLikegetTaxCalculationMode in interface CartLike<Cart>ChangeTaxCalculationModejavax.money.MonetaryAmount getTotalPrice()
getTotalPrice in interface CartLike<Cart>List<DiscountCodeInfo> getDiscountCodes()
CartLikegetDiscountCodes in interface CartLike<Cart>AddDiscountCode@Nullable CustomFields getCustom()
@Nullable PaymentInfo getPaymentInfo()
CartLikegetPaymentInfo in interface CartLike<Cart>AddPayment,
RemovePayment,
AddPayment,
RemovePayment@Nullable List<Reference<CartDiscount>> getRefusedGifts()
LineItemMode.GIFT_LINE_ITEM
is removed from this cart.@Nullable ShippingRateInput getShippingRateInput()
getShippingRateInput in interface CartLike<Cart>CartOrigin getOrigin()
List<Address> getItemShippingAddresses()
getItemShippingAddresses in interface CartLike<Cart>@Nullable KeyReference<Store> getStore()
static Reference<Cart> referenceOfId(String id)
An example for categories but this applies for other resources, too:
final String categoryIdFromFormOrSession = "84ac4271-0fec-49d0-9fee-55586c565c58"; final Reference<Category> categoryReference = Category.referenceOfId(categoryIdFromFormOrSession); assertThat(categoryReference.getId()).isEqualTo(categoryIdFromFormOrSession);See the test code.
If you already have a resource object, then use toReference() instead:
final Category category = getCategory1(); final Reference<Category> categoryReference = category.toReference(); assertThat(category.getId()).isEqualTo(categoryReference.getId());See the test code.
id - the ID of the resource which should be referenced.