UPS takes into account the value of the goods being shipped to produce its quote. This module is basically sending a 0 for the value of the products inside the box, so everything is being under-quoted. Consider adding code like this to commerce_ups.xml.inc around line 103 to include the order value with the shipping quote to get more accurate quotes.
$order_total = $order_wrapper->value();
$order_total = $order_total->commerce_order_total;
$order_total = array_values($order_total);
$order_currency = $order_total[0][0]['currency_code'];
$order_total = $order_total[0][0]['amount'];
$order_total = $order_total / 100;
$package_service_options = $package->addChild('PackageServiceOptions');
$insured_value = $package_service_options->addChild('InsuredValue');
$insured_value->addChild('CurrencyCode',$order_currency);
$insured_value->addChild('MonetaryValue',$order_total);
Comments
Comment #1
andrew m riley commentedThanks for looking into this Brent. I do think we should add this as a feature but I'm thinking it should be done on a per item basis. This way the shop owner gets to pick and choose which products are calculated as part of the total value and which ones are not. This way the users who want to use it can and the ones that don't want do don't have to and they have the flexibility of choosing both.
I'm going to talk with Ryan Szrama about possibly getting a new entity added to commerce_physical so all shipping modules will be able to take advantage of it. (I'll be asking about the feasibility of it living in the physical module vs shipping)
-- Research (for when I forget in a week why I wanted to go down this route) --
http://www.ups.com/content/us/en/shipping/time/service/value_added/decla...
http://www.ups.com/content/us/en/shipping/time/service/value_added/daily... (scroll down to declared value)
Declaring a value isn't something you have to do and it does affect the overall shipping cost. By default, without a declared value UPS' liability is limited to $100.
Pricing per domestic package and international shipment*:
$0.80 for each $100.00 (or portion of $100.00) of the total value declared, with a minimum charge of $2.40.
Comment #2
ultimikeI've opened up an issue in Commerce Shipping in regards to this request. In speaking with Andrew Riley (another one of the maintainers of Commerce UPS), we figured that other modules might need access to this data, so it belongs further up the chain.
Thanks,
-mike
Comment #3
googletorp commentedFYI: I've closed #1624878: "Declare product value" field? as won't fix.
Comment #4
svouthi commentedSince this module does not provide for adding the cost of insurance to shipments through passing on their value and there is no method built into Commerce for adding a fee based on the order subtotal using rules (I found only order total tokens which include the shipping cost), perhaps I can save others some time by providing the results of my searching. If you like, install Commerce Fees and Commerce Price By Components modules. After setup, compose rules to "apply a fee to an order" using the commerce-order:commerce-order-total:base-price:amount token (effectively the order subtotal) for each UPS insurance price bracket. e.g.:
UPS insurance rates (declared value charges) vary depending upon whether you are paying retail, standard/list, or perhaps a negotiated rate. Also, I am sure they are subject to periodic reevaluation and potential price increases, which would result in undercharging until the fees in the rules were adjusted to match. This is a very inelegant workaround. I would really like to see the declared value sent to UPS for accurate quoting real time.
Comment #5
svouthi commentedAll right, as googletorp states above, ultimike's issue in Commerce Shipping has been closed.
It looks like declaring a shipment value is either destined for an independent module or for each of the shipping modules themselves.
Unless, Mr. Riley, Ryan had anything to say about it?
Comment #6
svouthi commentedI tried inserting aiquandol's code -
and received a fatal error: Call to a member function addChild() on a non-object in /home/example/public_html/sites/all/modules/commerce_ups/commerce_ups.xml.inc on line 108
Has anyone else successfully inserted the above code to obtain UPS rates with insurance?
Comment #7
joelpittetI'm on board with committing this if someone can submit a working patch to this issue.