Commerce Custom Shipping Methods via Plugin I'm looking to add additional shipping methods through a plugin, using the documentation here: https://craftcommerce.com/docs/shipping-methods

I'm a little bit lost about how to hook things up, according to the docs I'm supposed to do:

public function commerce_registerShippingMethods()
{
    return [new CustomShipper_CourierDeliveryMethod()];
}


The docs don't really cover where and how to do this, other than to include it in the base plugin file. That part I can follow. Could someone help me understand what file to create, the basics of what it should include and how to connect it (referring to new CustomShipper_CourierDeliveryMethod())?

This is new to me for Craft Plugin development - I'm used to connecting to files using something like:

return [craft()-&gt;pluginHandle_serviceName-&gt;function_name()];


Which obviously is very differently than the above. Any help would be HUGELY appreciated.. thanks!
Ok, so what you're doing is returning a new instance of a shipping method class - this class must meet the Shipping Method interface - documented here: https://craftcommerce.com/docs/shipping-methods#shipping-method-interface

That is, you must implement each of those functions as defined by the interface in your shipping method class.

You'd define this class in a file of it's own named after the class, and in your base plugin file you require this class definition to bring it in to scope.

The same goes for your shipping rules - you again create a class that meets the interface and then require that in your main plugin file (or wherever you need to access the rule).