Class CartItem
Represents an item in a shopping cart, containing a product and its quantity.
Inherited Members
Namespace: UnityEngine.Purchasing
Assembly: Unity.Purchasing.dll
Syntax
public class CartItem
Constructors
CartItem(Product)
Initializes a new instance of the CartItem class with a specified product and a quantity of 1.
Declaration
public CartItem(Product product)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The product to be added to the cart. |
Properties
Product
The product associated with this cart item.
Declaration
public Product Product { get; }
Property Value
Type | Description |
---|---|
Product |
Quantity
The quantity of the product in the cart item.
Declaration
public int Quantity { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Equals(object)
Determines whether the specified object is equal to the current CartItem.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
bool | True if the specified object is a CartItem with the same product; otherwise, false. |
Overrides
GetHashCode()
Returns a hash code for this instance, which is based on the product's hash code.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance. |
Overrides
Operators
implicit operator CartItem(Product)
Declaration
public static implicit operator CartItem(Product product)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The product to convert. |
Returns
Type | Description |
---|---|
CartItem | A new CartItem instance with the specified product and a quantity of 1. |