Hi,

Our client is using flat rate delivery charges for things like standard 9-5 delivery or Pre-10am, or to ship to the Channel Islands which are all separate costs, they have around 10 of these different charges to select from which is already quite a lot. They require a separate option on that page in the form of a checkbox which allows the user to select "Saturday Delivery". The idea behind this being, that it should ADD a fee of £12.00 to any of the other delivery options already listed with one selected. The only way I can see to do this right now, would be to add another 10 flat rate options into the system all with the £12 added in, which would make the total number of delivery options quite large, so I am hoping as this is a special case of delivery that there is a way to add an additional form element and use rules to calculate the new costs?

Thanks

Comments

Project:Commerce Shipping» Commerce Flat Rate
Version:7.x-2.x-dev» 7.x-1.x-dev
Component:User interface» Code

Should be doable with rules.

Not related to commerce shipping anyways, moving to flat rate.

Component:Code» Documentation

Hmm - looking for something similar. I would like to simply add a checkbox that adds a set amount to the shipping total just as in the Shipping Method Example (which comes prebaked into Commerce Shipping).

Seems stunningly simple but could someone expand on just how you might achieve a checkbox option with rules? I'm aware of the rules framework but haven't used it so much in terms of giving options to users like that.

Status:Active» Fixed

This actually isn't achievable through Rules, because with the default Flat Rate display in the shipping services checkout pane you're still only going to be able to choose a single line item. What you really need to do is extend this module to use the service details callbacks; this is the part of the Commerce Shipping API where a module can add form elements to the shipping services checkout pane to collect additional information on the checkout form. You can actually see an example inside the Commerce Shipping Example module, which demonstrates adding a checkbox and textfield to the checkout pane and altering the price of shipping based on that data.

Your module can extend Commerce Flat Rate by implementing hook_commerce_shipping_service_info_alter(). This is documented in commerce_shipping.api.php.

We won't be adding such a feature to this module itself as it's too abstract; we can't easily build such a UI, and we're not sure it would handle all use cases anyways. Best to let module developers extend it specifically for their sites.

Status:Fixed» Closed (fixed)

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