ShippingMethodInterface

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

Interface ShippingMethod

View source (opens new window)

# 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 (opens new window)

Returns

string (opens new window)

# getHandle()

Returns the unique handle of this Shipping Method.

View source (opens new window)

Returns

string (opens new window)

# getId()

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

View source (opens new window)

Returns

integer (opens new window), null (opens new window) – 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 (opens new window)

Returns

boolean (opens new window)

# getMatchingShippingRule()

The first matching shipping rule for this shipping method

View source (opens new window)

Arguments

Returns

null (opens new window), craft\commerce\base\ShippingRuleInterface

# getName()

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

View source (opens new window)

Returns

string (opens new window)

# getPriceForOrder()

View source (opens new window)

Arguments

Returns

float (opens new window)

# getShippingRules()

Returns an array of rules that meet the ShippingRules interface.

View source (opens new window)

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 (opens new window)

Returns

string (opens new window)

# matchOrder()

Is this shipping method available to the order?

View source (opens new window)

Arguments

Returns

boolean (opens new window)