Skip to content

How Quotes Are Calculated

Paul Williams edited this page Dec 18, 2025 · 5 revisions

The math of how the module computes the final price of a particular shipping method from USPS can be expressed in the following function: (Sorry for the math flashbacks)

$((M_{Quote} + M_{Handling} + M_{Services}) \times N_{Boxes}) + (O_{Handling} \times (N_{Boxes} | 1))$

Where the variables are:

  • $M$ for the Method in question. But in particular
    $M_{Quote}$ : represents the quoted price of the method.
    $M_{Handling}$ : represents the handling surcharge of THAT particular method.
    $M_{Services}$ : represents the charges for any service attached to that method (Certified Mail, Sunday delivery, etc.)
  • $N_{Boxes}$ represents the number of boxes of an order (as determined by ZenCart)
  • $O_{Handling}$ represents the handling fee as configured overall.
  • $(N_{Boxes} | 1)$ represents either the number of boxes or 1 (for the whole order). This is represented by the prompt for Handling Per Order or Per Box.

For example, let's make a quote for a two box order with a calculated rate for USPS Ground Advantage being $8.00. (Box in this case is what ZenCart figured the order to "fit" in.)

image
Overall Handling Fee set to $3 Domestic, $0 International and being applied on a per order basis. (This option will likely be renamed to surcharge in a future update.)

image
Focusing on Ground Advantage for this, it has a $2.00 handling surcharge for that method.

image
We'll say that Certified Mail has a Surcharge of $4 for this example.

Let's plug it into the formula:

$((M_{Quote} + M_{Handling} + M_{Services}) \times N_{Boxes}) + (O_{Handling} \times (N_{Boxes} | 1)$
$((8.00 + 2.00 + 4.00) \times 2 ) + (3.00 \times 1)$ - Plug in the values as necessary. Because the site configured to charge $3.00 per order, we multiply by 1 instead.
$(14.00 \times 2) + 3.00)$ - Basic arithmetic at this point, work within the parentheses first.
$28.00 + 3.00$ - More arithmetic to simplify the parentheses.
$31.00$ - Combining whatever is left.

$31.00 will be the final cost of the quote for this Ground Advantage quote.

That's generally how this module calculates the quotes. In short, each module can have a surcharge applied on it and/or you can apply a superceding surcharge on the whole order or each box of the order. Be careful with the setting of the surcharges/handling charges. As it can detract you from customers.

Clone this wiki locally