# Shipping cost of 10.49 round to 10.00 in payment module

## Recommended Posts

Ok, my web guy changed the coding as suggested on here and it still is rounding for us.

Here is my table rate:

20:4.75, 50:6.00, 75:8.00, 100:0.00

And currently I have a total of \$68.97 in my cart and the shipping is saying I will be charged \$8.00. This is incorrect, I should be charged \$6.00. So, it is still rounding. What is the problem? Do I have the Table rates wrong? This shipping thing is driving me insane. Someone PLEEEEASE HELP!!!!!

##### Share on other sites
Ok, my web guy changed the coding as suggested on here and it still is rounding for us.

Here is my table rate:

20:4.75, 50:6.00, 75:8.00, 100:0.00

And currently I have a total of \$68.97 in my cart and the shipping is saying I will be charged \$8.00. This is incorrect, I should be charged \$6.00. So, it is still rounding. What is the problem? Do I have the Table rates wrong? This shipping thing is driving me insane. Someone PLEEEEASE HELP!!!!!

If I am correct your table says:

0-20 = \$4.75

20-50 = \$6.00

50-75 = \$8

75-100 = \$0

So the quote is correct !

##### Share on other sites
Ok, my web guy changed the coding as suggested on here and it still is rounding for us.

Here is my table rate:

20:4.75, 50:6.00, 75:8.00, 100:0.00

And currently I have a total of \$68.97 in my cart and the shipping is saying I will be charged \$8.00. This is incorrect, I should be charged \$6.00. So, it is still rounding. What is the problem? Do I have the Table rates wrong? This shipping thing is driving me insane. Someone PLEEEEASE HELP!!!!!

Hi Marie,

Your code is fine. With this rate table, you should be charged \$8 for any purchase between \$50 and \$75. You need to change your table, if that's not what you want.

##### Share on other sites
Hi Marie,

Your code is fine. With this rate table, you should be charged \$8 for any purchase between \$50 and \$75. You need to change your table, if that's not what you want.

Please forgive me....I am reading the table incorrectly. It's was a long night for me and this is exactly why I have a web guy doing this for me and not me personally.

Thank you all for your help. So, the code did work!!!!

:D

##### Share on other sites

I'm having the same issue, except I'm using Multi-Vendor Shipping and the fix posted above doesn't seem to work for that, I also tried implementing the fix to the MVS code in checkout_shipping.php here:

I changed:

```		  if (isset(\$quote['error'])) {
tep_session_unregister('shipping');
} else {
if ( (isset(\$quote[0]['methods'][0]['title'])) && (isset(\$quote[0]['methods'][0]['cost'])) ) {
\$output[\$vendor_id] = array('id' => \$module . '_' . \$method,
'title' => \$quote[0]['methods'][0]['title'],
'ship_tax' => \$ship_tax,
'products' => \$products_array,
'cost' => \$quote[0]['methods'][0]['cost']
);
\$total_ship_tax += \$ship_tax;
\$total_shipping_cost += \$quote[0]['methods'][0]['cost'];```

To the following:

```		  if (isset(\$quote['error'])) {
tep_session_unregister('shipping');
} else {
if ( (isset(\$quote[0]['methods'][0]['title'])) && (isset(\$quote[0]['methods'][0]['cost'])) ) {
\$output[\$vendor_id] = array('id' => \$module . '_' . \$method,
'title' => \$quote[0]['methods'][0]['title'],
'ship_tax' => \$ship_tax,
'products' => \$products_array,
// >>> BEGIN - Modification to Fix Shipping Rounding Problem at Order Confirmation
//'cost' => \$quote[0]['methods'][0]['cost']);
'cost' => sprintf("%f", \$quote[0]['methods'][0]['cost'])

);
\$total_ship_tax += \$ship_tax;
\$total_shipping_cost += sprintf("%f", \$quote[0]['methods'][0]['cost']);```

But the shipping is still rounded, I also tried the other changes as well, nothing works.

Thank You,

James Black

##### Share on other sites

I am SO glad to find this thread and quickly, too, and the fix using sprintf does indeed work.

Before coming back here (I have been absent many months), I tried pinning this error down and was stumped except to recognize it was a rounding phenomenon.

This happened to a site of mine that had run correctly for a full year at ipowerweb on one of its oldest servers, but when we migrated it to a new vDeck server, voila ... rounding occurs.

Thank goodness for the osC forum and a robust user community! Happy Holidays to all.

##### Share on other sites

I'm glad I found this thread but the fix, sadly, does not work for me. I use Zone rates and UK special Delivery and OSC is rounding, can anyone offer some guidance as how I might go about correctling this?

Thanks, Sarah

##### Share on other sites
I'm glad I found this thread but the fix, sadly, does not work for me. I use Zone rates and UK special Delivery and OSC is rounding, can anyone offer some guidance as how I might go about correctling this?

Thanks, Sarah

Oops, perhaps I should also say that the rounding occurs on the checkout_shipping.php page only, when I get to order_confirmation.php the values are correct!

##### Share on other sites
Oops, perhaps I should also say that the rounding occurs on the checkout_shipping.php page only, when I get to order_confirmation.php the values are correct!

Can anyone help me understand why the zone rates change between the checkout_shipping.php and order_confirmation.php.

On checkout_shipping I have a value of \$1.77 but when I get through to order_confirmation this value has been reduced to \$1.63!! What heppens between/on order_confirmation to make this change?

I really hope someone can help me on this.

Sarah