ShippingMethodInterface

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

Interface ShippingMethod

View source

# Public Methods

Method Description
getCpEditUrl() Returns the control panel URL to manage this method and its rules.
getHandle() Returns the unique handle of this Shipping Method.
getId() Returns the ID of this Shipping Method, if it is managed by Craft Commerce.
getIsEnabled() Returns whether this shipping method is enabled for listing and selection by customers.
getMatchingShippingRule() The first matching shipping rule for this shipping method
getName() Returns the name of this Shipping Method as displayed to the customer and in the control panel.
getPriceForOrder()
getShippingRules() Returns an array of rules that meet the ShippingRules interface.
getType() Returns the type of Shipping Method. This might be the name of the plugin or provider.
matchOrder() Is this shipping method available to the order?

# getCpEditUrl()

Returns the control panel URL to manage this method and its rules.

An empty string will result in no link.

View source

Returns

string

# getHandle()

Returns the unique handle of this Shipping Method.

View source

Returns

string

# getId()

Returns the ID of this Shipping Method, if it is managed by Craft Commerce.

View source

Returns

integer, null – The shipping method ID, or null if it is not managed by Craft Commerce

# getIsEnabled()

Returns whether this shipping method is enabled for listing and selection by customers.

View source

Returns

boolean

# getMatchingShippingRule()

The first matching shipping rule for this shipping method

View source

Arguments

Returns

null, craft\commerce\base\ShippingRuleInterface

# getName()

Returns the name of this Shipping Method as displayed to the customer and in the control panel.

View source

Returns

string

# getPriceForOrder()

View source

Arguments

Returns

float

# getShippingRules()

Returns an array of rules that meet the ShippingRules interface.

View source

Returns

craft\commerce\base\ShippingRuleInterface[] – The array of ShippingRules

# getType()

Returns the type of Shipping Method. This might be the name of the plugin or provider.

The core shipping methods have type: Custom. This is shown in the control panel only.

View source

Returns

string

# matchOrder()

Is this shipping method available to the order?

View source

Arguments

Returns

boolean