Shipping method schema for E-Commerce module.
Supports weight-based, price-based, and geographic restrictions.
Fields
name- Method name (required)slug- URL-friendly identifier (unique, auto-generated)description- Method descriptionprice- Shipping costfree_above_amount- Free shipping thresholdmin_weight_grams,max_weight_grams- Weight limitsmin_order_amount,max_order_amount- Order amount limitscountries- Allowed countries (empty = all)excluded_countries- Excluded countriesactive- Enabled/disabledposition- Sort orderestimated_days_min,estimated_days_max- Delivery estimatetracking_supported- Tracking available
Summary
Functions
Returns true if method is active.
Checks if this method is available for given cart parameters.
Calculates shipping cost for given subtotal. Returns 0 if free shipping threshold is met.
Changeset for shipping method creation and updates.
Returns estimated delivery string.
Checks if shipping is free for the given subtotal.
Types
@type t() :: %PhoenixKitEcommerce.ShippingMethod{ __meta__: term(), active: term(), countries: term(), currency: term(), description: term(), estimated_days_max: term(), estimated_days_min: term(), excluded_countries: term(), free_above_amount: term(), inserted_at: term(), max_order_amount: term(), max_weight_grams: term(), metadata: term(), min_order_amount: term(), min_weight_grams: term(), name: term(), position: term(), price: term(), slug: term(), tracking_supported: term(), updated_at: term(), uuid: term() }
Functions
Returns true if method is active.
Checks if this method is available for given cart parameters.
Examples
iex> available_for?(method, %{weight_grams: 500, subtotal: Decimal.new("50"), country: "EE"})
true
Calculates shipping cost for given subtotal. Returns 0 if free shipping threshold is met.
Changeset for shipping method creation and updates.
Returns estimated delivery string.
Examples
iex> delivery_estimate(%ShippingMethod{estimated_days_min: 3, estimated_days_max: 5})
"3-5 days"
iex> delivery_estimate(%ShippingMethod{estimated_days_min: 1, estimated_days_max: 1})
"1 day"
Checks if shipping is free for the given subtotal.