pub struct CreateProductVariant {
pub sku: String,
pub name: Option<String>,
pub price: Decimal,
pub compare_at_price: Option<Decimal>,
pub cost: Option<Decimal>,
pub barcode: Option<String>,
pub weight: Option<Decimal>,
pub weight_unit: Option<String>,
pub options: Option<Vec<VariantOption>>,
pub is_default: Option<bool>,
}Expand description
Input for creating a product variant
Fields§
§sku: String§name: Option<String>§price: Decimal§compare_at_price: Option<Decimal>§cost: Option<Decimal>§barcode: Option<String>§weight: Option<Decimal>§weight_unit: Option<String>§options: Option<Vec<VariantOption>>§is_default: Option<bool>Trait Implementations§
Source§impl Clone for CreateProductVariant
impl Clone for CreateProductVariant
Source§fn clone(&self) -> CreateProductVariant
fn clone(&self) -> CreateProductVariant
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 CreateProductVariant
impl Debug for CreateProductVariant
Source§impl Default for CreateProductVariant
impl Default for CreateProductVariant
Source§fn default() -> CreateProductVariant
fn default() -> CreateProductVariant
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CreateProductVariant
impl<'de> Deserialize<'de> for CreateProductVariant
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateProductVariant, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateProductVariant, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for CreateProductVariant
impl Serialize for CreateProductVariant
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 CreateProductVariant
impl Validate for CreateProductVariant
Source§fn validate(&self) -> Result<(), CommerceError>
fn validate(&self) -> Result<(), CommerceError>
Validate a product-variant create request.
Requires a valid SKU and rejects negative monetary amounts (price, the optional compare-at price, cost) and a negative weight. A zero price is permitted (e.g. a free sample); only negative amounts are rejected.
Auto Trait Implementations§
impl Freeze for CreateProductVariant
impl RefUnwindSafe for CreateProductVariant
impl Send for CreateProductVariant
impl Sync for CreateProductVariant
impl Unpin for CreateProductVariant
impl UnsafeUnpin for CreateProductVariant
impl UnwindSafe for CreateProductVariant
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