Skip to content

ShippingMethodInterface ​

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

Interface ShippingMethod

View source

Public Methods ​

MethodDescription
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

getHandle() ​

Returns the unique handle of this Shipping Method.

View source

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

getMatchingShippingRule() ​

The first matching shipping rule for this shipping method

View source

Arguments ​

  • $order

getName() ​

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

View source

getPriceForOrder() ​

View source

Arguments ​

  • $order

getShippingRules() ​

Returns an array of rules that meet the ShippingRules interface.

View source

Returns ​

\Illuminate\Support\Collection<\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

matchOrder() ​

Is this shipping method available to the order?

View source

Arguments ​

  • $order