I'm implementing a custom FedEx integration solution for a Magento site. Part of this is to add a signature requirement checkbox in the onepage checkout, and add $3 if this is checked. Unfortunately it seems that the FedEx Rate Web Service doesn't take any parameter regarding signature requirements, so I must manually add this cost to the order.
I was thinking about taking one of these two approaches, but I'm not sure will be best nor am I sure how to actually accomplish it:
Add $3 to whatever price FedEx returns
Create a new line item for this
Assuming that I have a handle on the $order, which solution would be best and how would I do it?
The code should run inside an observer method which is called by the checkout_controller_onepage_save_shipping_method
event, which is triggered immediately after $this->getOnepage()->saveShippingMethod($data);
. This means I can't add $3 when the FedEx API returns a result, as I won't know if the checkbox is checked until afterwards.
I came up with a solution; it's not the best but it works perfectly fine for me: