ShippingRuleInterface

Type
Interface
Namespace
craft\commerce\base
Implemented by
craft\commerce\models\ShippingRule
Since
2.0

Interface ShippingRule

View source

Public Methods

MethodDescription
getBaseRate()Returns a base shipping cost. This is added at the order level.
getDescription()Returns a description of the rates applied by this rule; Zero will not make any changes.
getIsEnabled()Returns whether this shipping rule is enabled for listing and selection.
getMaxRate()Returns a max cost this rule should ever apply.
getMinRate()Returns a min cost this rule should have applied.
getOptions()Returns this data as json on the order's shipping adjustment.
getPerItemRate()Returns the flat rate that is multiplied per qty.
getPercentageRate()Returns the percentage rate that is multiplied per line item subtotal.
getWeightRate()Returns the rate that is multiplied by the line item's weight.
matchOrder()Returns whether this rule a match on the order. If false is returned, the shipping engine tries the next rule.

getBaseRate()

Returns a base shipping cost. This is added at the order level. Zero will not make any changes.

View source

Returns

float

Signature

public abstract float getBaseRate ( )

getDescription()

Returns a description of the rates applied by this rule; Zero will not make any changes.

View source

Returns

string

Signature

public abstract string getDescription ( )

getIsEnabled()

Returns whether this shipping rule is enabled for listing and selection.

View source

Returns

boolean

Signature

public abstract boolean getIsEnabled ( )

getMaxRate()

Returns a max cost this rule should ever apply. If the total of your rates as applied to the order are greater than this, an order level adjustment is made to reduce the shipping amount on the order.

View source

Returns

float

Signature

public abstract float getMaxRate ( )

getMinRate()

Returns a min cost this rule should have applied. If the total of your rates as applied to the order are less than this, the baseShippingCost on the order is modified to meet this min rate. Zero will not make any changes.

View source

Returns

float

Signature

public abstract float getMinRate ( )

getOptions()

Returns this data as json on the order's shipping adjustment.

View source

Returns

mixed

Signature

public abstract mixed getOptions ( )

getPerItemRate()

Returns the flat rate that is multiplied per qty. Zero will not make any changes.

View source

Arguments

  • $shippingCategory (integer, null) – The shipping category for the rate requested. A null category should use the default shipping category set up in Craft Commerce.

Returns

float

Signature

public abstract float getPerItemRate ( $shippingCategory )

getPercentageRate()

Returns the percentage rate that is multiplied per line item subtotal. Zero will not make any changes.

View source

Arguments

  • $shippingCategory (integer, null) – The shipping category for the rate requested. A null category should use the default shipping category set up in Craft Commerce.

Returns

float

Signature

public abstract float getPercentageRate ( $shippingCategory )

getWeightRate()

Returns the rate that is multiplied by the line item's weight. Zero will not make any changes.

View source

Arguments

  • $shippingCategory (integer, null) – The shipping category for the rate requested. A null category should use the default shipping category set up in Craft Commerce.

Returns

float

Signature

public abstract float getWeightRate ( $shippingCategory )

matchOrder()

Returns whether this rule a match on the order. If false is returned, the shipping engine tries the next rule.

View source

Arguments

Returns

boolean

Signature

public abstract boolean matchOrder ( craft\commerce\elements\Order $order )