Following the example shipping method and contrib module Commerce Shipping Flat Rate I was able to create my own flat rate module which offers it's own radiobutton during checkout.

How can I define/enable multiple options (with different rates) from my module? Is it possible or do I have to create multiple modules for each different flat rate quote?

Comments

elpino’s picture

Title: Is it possible to define multiple flat rate options in a single shipping method module » Define multiple shipping method plugins in a single shipping method module

I've figured out that all I have to do is provide multiple plugin folders in the same module pack. Each obviously with it's own named folder containing similarly named .class.php and .inc files.

Although I'm not sure if creating each individual class definition was necessary or if declaring one same class in all .inc files is possible.

The problem now is I don't know how to assign weight values to each plugin so that they are arranged correctly in the Shipping Settings page (/admin/commerce/config/shipping-methods) which I suspect influences the radio button options during checkout. But I guess this should be addressed on a different issue.

googletorp’s picture

Status: Active » Fixed

Closing

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.