# Quantity band from parent calculator

The Quantity band from parent calculator is a calculator that takes a specific amount of the quantity of a parent product and puts that in the quantity of the child product.

This calculator can be used to calculate different prices for different quantity bands/ranges (tiers). For example the first 1000 Liters of fuel is charged with a higher price than the liters above 1000.

# Configuration

To use this calculator different child products per quantity band must be created and use the QuantityBetween setting to determine their quantity with respect to the parent service. In the above example two child products would need to be created, one for the first 1000 liters and one for the next and one group product. The total amount of fuel has to be filled in in the group product only when using the product on an order. The calculator automatically assigns the correct quantities to the applicable child products.

When creating the child products, the setting 'Take quantity from group' must be set to 'Quantity from group' instead of the default 'None'.

In the parent product the options 'Is group' and 'Is group with quantity and supplier' must be checked.

# Required price calculator setting

QuantityBetween (int, no default)
This setting must always be used in combination with the calculator. The setting specifies the quantity band which should be used from the parent. The format of the setting is 'QuantityBetween=value1 and value2'.

For a group of products, from the second product and onward, the QuantityBetween setting should start with the value of the previous end interval such that when adding up all the calculated intervals, they will match the parent quantity.
The calculator formula is:
result = Minimum(ParentQuantity, Value2) - Value1, when ParentQuantity > Value1, otherwise result = 0;

In the case of the example mentioned above the two price calculator setting would look like this: 'QuantityBetween=0 and 1000 and 'QuantityBetween=1000 and 9999999'.

The end result of the example mentioned above will look like this. The total quantity of the fuel sold is 2000 liters. The price for the first 1000 liters is 0.80. Everything after that is 0.70.

# Example

In this example, the first 2 units of a product are provided for free. Additional units of the product have a per unit fee of \$40.

1) Create a parent product that will be the main product added to an order.

Is group with quantity and supplier must be checked.

Take quantity from group should be set to None (quantity from self).

2) Create a child product to use for the first tier of pricing. In this example, the first tier of pricing is 2 items for free.

Take quantity from group should be set to Quantity from from group.

Scroll down to the Special price calculation section.

Price calculator should be set to Quantity Band From Parent.

Price calculator settings is a field that requires that you enter a simple formula. In this example, the formula QuantityBetween=0 and 2 is entered, since the first tier of pricing is 2 units for free

3) Create a child product to use for the second tier of pricing. In this example, the second tier of pricing is 3 or more items at a per unit fee of \$40.

Take quantity from group should be set to Quantity from from group.

Scroll down to the Special price calculation section.

Price calculator should be set to Quantity Band From Parent.

Price calculator settings is a field that requires that you enter a simple formula. In this example, the formula QuantityBetween=2 and 100 is entered, since the second tier of pricing is 3 or more items at a per unit fee of \$40.

4) Once the parent and two child products have been created, connect the child products to the parent product. Be sure to check the Auto-add option so the child products will automatically be listed under the parent product on orders.

5) Create price agreements for the child products.

In this example, the first tier child product (quantity 0 – 2) is free.

The second tier child product (quantity 3 - 100) is charged at \$40 per item.

6) The parent product is added to an order.

7) The total quantity is entered in the parent product. In this example, total quantity is 9.

8) Configuration of the Quantity Band from Parent Calculator ensures the pricing based on quantity tiers is accurate.

The quantity of 9 automatically splits between the first 2 items at \$0 rate, and following 7 items at \$40 rate.