php shopping cart
free shopping cart   shopping cart software

Free Shopping Cart PHP Software


Back to Functions List
This Function Has Been Available Since:
(AFCommerce v 2.1,     Functions v 1.1)

Determines the shipping total based on which method you selected in the admin area.


float = afc_calculateshipping ()

This is the function that calculates the shipping total for all shipping methods. If you are using one of the standard methods, like flat rate, by weight, etc, the total shipping is figured out when this function is called (in the checkout.php page). If you are using one of the new shipping APIs like UPS or FedEx, this function will check to see if a quote was given, and if not, redirect the user to the page for that API.


There are no parameters for this function.

Return Values

Returns the total amount of the shipping cost.

Open Source: Yes

Paul's Examples

No examples for this function are necessary because this function is only needed in the checkout.php file, where it is already being called. I wouldn't move where this function is called. If you want to add a new shipping method, you should probably add it to this function's file, which is open source for this reason. Since the admin area is encrypted, I would hard code any information you would normally store in the database.

If you add a new method that works perfectly, I can send you an open source version of the admin page's file, however if it does in fact work perfectly, you will have to contribute this feature to the community. I have no need for it, but other people might, so your contribution would be given to the public for free.

Back to Functions List


(2691) blklineSunday September 3, 2006 at 4 : 50 pm


I'm trying to use the USPS module and when I try to run my test for the account I set up at the website I get an error instead of a price for shipping.

It looks like this....






I looked at the perl script and it seems that this is a default error message in AFCommerce, and not from the USPS site, but I can't figure out why I am getting it.

Betty Lou Kline Your Quiet Retreat

AFCommerce Documentation

High End Website DevelopmentCompletely Free
Dating Service
Copyright 2004 - 2006
AFCommerce Website
And Cart Builder