Closed (fixed)
Project:
Ubercart
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2010 at 21:40 UTC
Updated:
21 Sep 2012 at 18:32 UTC
When using Flat Rate shipping to determine shipping cost based on Order Total, non-shippable products are not removed from the order-total calculation.
IE:
Item #1 - $5 Shippable
Item #2 - $25 Non-Shippable
Flate Rate Shipping:
Total<$10 = Ship cost: $2.50
Total>$10 = Ship cost: $5.00
Basically if a user orders both items #1 & #2, the will be charged $5 shipping even though #2 is non shippable.
I have played with the flags and filters and can't find a way to exclude non-shippable items from my Fixed Shipping calculations. Can someone please help?
Comments
Comment #1
tr commentedFlat Rate, like all other shipping methods, never sees any non-shippable products - those are removed by uc_quote before the shipping method is called. Your problem is that you have the flat rates set up as a base rate only, with no per-product rate. So the shipping cost calculated by your flat rate methods will *always* return the base rate, under all conditions.
The Conditional Actions you set up control whether the shipping method is run or not, based on the total dollar value of the order. They don't calculate shipping cost, nor do they affect the shipping cost. The order total condition tests the order total - the order total doesn't and shouldn't change based on whether some products are shippable or not.
When you set up a rule that allowed Flat Rate to charge a base rate if the order total is >$10, that's what you got, and it worked as designed. If your Flat Rate charged a per-product rate when the order total was >$10, you would see a shipping cost = #shippable products * per-product rate.
So it's your logic that's at fault here, not the flat rate module. If you want to calculate the total price of all shippable products then you're going to have to figure out a combination of conditions or code a PHP condition to compute the value you're interested in.
Comment #2
michaeljw commentedHi,
I'm struggling to get to grips with setting a maximum shipping cost.
The desired shipping costs are:
20% upto a maximum of £12 shipping.
I have used a combination of flat rate and the "Ubercart Percent Rate with Minimum Rate" module to do this as follows:
IF (order total < £60), per product shipping cost is 20% of total;
IF (order total >= £60), base rate shipping = £12, per product shipping = £0.
The problem is that some items are not shippable, meaning that the routine breaks down if the order total is more than £60 and includes a non-shippable product.
I'd be grateful if you could help to solve this?
The best way forward would be if I could somehow set a maximum shipping cost in the Ubercart Percent Rate with Minimum Rate module. Is this achievable? I can do php coding to an intermediate level.
Your ideas would be a great help!
Thanks,
Michael
Comment #3
longwaveThe original issue was solved in #1, and #2 should be a feature request for the module in question.
Comment #4
kristen polYou can create your own condition similar to the one in the uc_order module to make this happen as follows:
1) add in hook_ca_condition like:
2) Add in the mymodule_condition_shippable_total function like:
3) Add in helper function mymodule_get_shippable_total like:
4) Add in condition settings form like:
Have fun!
Kristen
Comment #5
ssn commentedWorked like a magic exactly what we needed for our project... u rock Kirsten pol...
you saved my day. :)
many thanks again..
Comment #6
kristen polGlad to hear it was useful for someone ;)
Comment #7
khan2ims commentedThanks a lot. It helped me to add a condition to count number of shippable products.
Here is my code