Non-shippable items contribute to order weight

Project:Ubercart Contributions
Component:Code
Category:bug report
Priority:critical
Assigned:ktf
Status:patch (needs review)
Description
Project: 
Ubercart

We sell print books and ebooks on our site, using attributes and file downloads. A user can buy a print book, an ebook, or a combination of the two. Ebooks are marked as non-shippable in the "features" section of the edit product page, with a separate SKU.

If a user buys at least one shippable product, the order's total weight will include even the non-shippable items. For instance, if they buy the following:

- BookA (physical book, 2lbs)
- BookB (physical book, 2lbs)
- BookC (ebook only -- the physical book is 2 lbs, but the ebook should be zero)

The user will then be charged for shipping as if their order was 6 lbs, instead of 4. One possible workaround would be to add a negative value to the "weight" value under the "options" tab of every book that is also being sold as an ebook, but this seems strange to me, and would mean two separate fields to alter if the weight for a product changed. If the SKU for the ebook is set to be non-shippable, the weight for that SKU should be zero.

It looks like the change should be made in uc_order_condition_products_weight(), but I'm not sure how to do it myself.

NOTE: this is in UC version 2.3, which isn't available as an option in the "Version" dropdown in this issue tracker. 2.x-dev was the closest, so I picked that...

Version: 
Ubercart 2.x-dev
ktf
ktf's picture
Offline
Joined: 06/22/2009
Juice: 83
#1
Status:active» patch (needs review)

Well, I sat down today and fixed this problem, at least for me. I'm attaching a patch here. I'm not sure if this breaks anything, or is unsafe in any way, but it stops our customers from being charged shipping for digital goods. Yay!

AttachmentSize
Patch to fix the problem I guess? 1.24 KB
ktf
ktf's picture
Offline
Joined: 06/22/2009
Juice: 83
#2
Assigned to:Guest» ktf

So this issue isn't actually appearing anywhere in the issue tracker. Maybe assigning it to myself will help?