Skip to main content

CreatePromotionInput

Struct CreatePromotionInput 

Source
pub struct CreatePromotionInput {
Show 31 fields pub code: Option<String>, pub name: String, pub description: Option<String>, pub internal_notes: Option<String>, pub promotion_type: Option<String>, pub trigger: Option<String>, pub target: Option<String>, pub stacking: Option<String>, pub percentage_off: Option<f64>, pub fixed_amount_off: Option<f64>, pub max_discount_amount: Option<f64>, pub buy_quantity: Option<i32>, pub get_quantity: Option<i32>, pub get_discount_percent: Option<f64>, pub tiers: Option<String>, pub bundle_product_ids: Option<Vec<String>>, pub bundle_discount: Option<f64>, pub starts_at: Option<String>, pub ends_at: Option<String>, pub total_usage_limit: Option<i32>, pub per_customer_limit: Option<i32>, pub applicable_product_ids: Option<Vec<String>>, pub applicable_category_ids: Option<Vec<String>>, pub applicable_skus: Option<Vec<String>>, pub excluded_product_ids: Option<Vec<String>>, pub excluded_category_ids: Option<Vec<String>>, pub eligible_customer_ids: Option<Vec<String>>, pub eligible_customer_groups: Option<Vec<String>>, pub currency: Option<String>, pub priority: Option<i32>, pub metadata: Option<String>,
}
Expand description

Input for creating a promotion

Fields§

§code: Option<String>

Optional promotion code (auto-generated if not provided)

§name: String

Display name

§description: Option<String>

Description for customers

§internal_notes: Option<String>

Internal notes

§promotion_type: Option<String>

Type: percentage_off, fixed_amount_off, buy_x_get_y, free_shipping, tiered_discount, bundle

§trigger: Option<String>

Trigger: automatic, coupon_code, both

§target: Option<String>

Target: order, product, category, shipping, line_item

§stacking: Option<String>

Stacking: stackable, exclusive, selective_stack

§percentage_off: Option<f64>

Percentage off (0.0-1.0, e.g., 0.20 for 20%)

§fixed_amount_off: Option<f64>

Fixed amount off

§max_discount_amount: Option<f64>

Maximum discount amount (cap)

§buy_quantity: Option<i32>

Buy X quantity (for BOGO)

§get_quantity: Option<i32>

Get Y quantity (for BOGO)

§get_discount_percent: Option<f64>

Discount on “get” items (1.0 = free, 0.5 = 50% off)

§tiers: Option<String>

Tiered discount rules as JSON

§bundle_product_ids: Option<Vec<String>>

Bundle product IDs as JSON array

§bundle_discount: Option<f64>

Bundle discount

§starts_at: Option<String>

Start date (RFC3339)

§ends_at: Option<String>

End date (RFC3339)

§total_usage_limit: Option<i32>

Total usage limit

§per_customer_limit: Option<i32>

Per customer usage limit

§applicable_product_ids: Option<Vec<String>>

Applicable product IDs

§applicable_category_ids: Option<Vec<String>>

Applicable category IDs

§applicable_skus: Option<Vec<String>>

Applicable SKUs

§excluded_product_ids: Option<Vec<String>>

Excluded product IDs

§excluded_category_ids: Option<Vec<String>>

Excluded category IDs

§eligible_customer_ids: Option<Vec<String>>

Eligible customer IDs

§eligible_customer_groups: Option<Vec<String>>

Eligible customer groups

§currency: Option<String>

Currency code

§priority: Option<i32>

Priority (lower = applied first)

§metadata: Option<String>

Metadata as JSON

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> JsValuesTupleIntoVec for T
where T: ToNapiValue,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more