How to calculate the shipping fees based on the quantity ordered?

You can use the QUANTITY function to calculate the order quantity and then write formulas based on this order quantity to apply a per-item shipping fee, a tiered shipping fee & other advanced shipping fee options.

How to calculate the order quantity?

How to calculate the shipping fee based on order quantity?

Fixed per-item shipping fee

Let's say the fixed shipping fee per item is $2. We can write a simple calculation to multiply the order quantity by 2 to calculate the total shipping fee. We can use the CURRENCY function to display the calculated value as a currency.

CURRENCY("$", Order quantity * 2)

Advanced per-item shipping fee

Example #1:
Let's say the shipping fee for the first item is $10 and for each additional item, the shipping fee is $5. If a user orders 3 items, the shipping fee would be $10 for the first item and $5 for the other two items. The total shipping fee would be $20.

Formula to calculate the total shipping fee:
CURRENCY("$", 10 + (Order quantity - 1) * 5)

Example #2:
Let's say the shipping fee per item is $2 and you get a discounted shipping fee of $15 for a pack of 10 items. If a user orders 22 items, the shipping fee would $30 for 20 items plus and additional $4 for 2 individual items.

Formula to calculate the total shipping fee:
CURRENCY("$", Math.floor(Order quantity / 10) * 15 + (Order quantity % 10) * 2)

Math.floor function returns the largest integer less than or equal to a given number. For example Math.floor(22/10) will return 2. We can use this function to find the number of 10 packs in the order quantity.

The remainder operator % returns the integer left over after dividing one number by another. For example, 10 % 3 will return 1. 22 % 10 will return 2.

How to calculate the total amount including the shipping fee?