pub struct AddCartItem {
pub product_id: Option<ProductId>,
pub variant_id: Option<Uuid>,
pub sku: String,
pub name: String,
pub description: Option<String>,
pub image_url: Option<String>,
pub quantity: i32,
pub unit_price: Decimal,
pub original_price: Option<Decimal>,
pub weight: Option<Decimal>,
pub requires_shipping: Option<bool>,
pub metadata: Option<Value>,
}Expand description
Input for adding an item to cart
Fields§
§product_id: Option<ProductId>§variant_id: Option<Uuid>§sku: String§name: String§description: Option<String>§image_url: Option<String>§quantity: i32§unit_price: Decimal§original_price: Option<Decimal>§weight: Option<Decimal>§requires_shipping: Option<bool>§metadata: Option<Value>Trait Implementations§
Source§impl Clone for AddCartItem
impl Clone for AddCartItem
Source§fn clone(&self) -> AddCartItem
fn clone(&self) -> AddCartItem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AddCartItem
impl Debug for AddCartItem
Source§impl Default for AddCartItem
impl Default for AddCartItem
Source§fn default() -> AddCartItem
fn default() -> AddCartItem
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AddCartItem
impl<'de> Deserialize<'de> for AddCartItem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AddCartItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AddCartItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for AddCartItem
impl Serialize for AddCartItem
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl Validate for AddCartItem
impl Validate for AddCartItem
Source§fn validate(&self) -> Result<(), CommerceError>
fn validate(&self) -> Result<(), CommerceError>
Validate an item being added to a cart.
Rejects empty SKU/name, a non-positive quantity, and a negative unit or original price. A zero unit price is allowed (e.g. a free/gift item), but a negative price never is.
Auto Trait Implementations§
impl Freeze for AddCartItem
impl RefUnwindSafe for AddCartItem
impl Send for AddCartItem
impl Sync for AddCartItem
impl Unpin for AddCartItem
impl UnsafeUnpin for AddCartItem
impl UnwindSafe for AddCartItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more