# Understanding Bundle Pricing and Weight Price Algorithm in Simple Bundles 2.0

## Introduction

When you purchase a bundle of products through Simple Bundles 2.0 on Shopify, the final price you pay is calculated based on a special pricing mechanism. This help doc will guide you through how the bundle pricing works and how the weight price algorithm is utilized to allocate the bundle price to its individual components.

## Bundle Pricing

In Simple Bundles 2.0, the final price of the bundle is based off of the bundle product price, with any additional adjustments if present.

Here’s an example to help you understand:

Imagine you are purchasing a bundle that includes a t-shirt and a pair of shorts. The bundle price is $50. In this case, the final price you pay for the bundle would be the bundle product price of $50, plus any adjustments if there are any.

## Weight Price Algorithm

Once you proceed to checkout, Shopify uses a weight price algorithm to allocate the final bundle price to each of the individual components in the bundle. This is done based on the weight of each component line, where the weight of a component is calculated as the unit price multiplied by the quantity (unit price * quantity).

Here’s a step-by-step example to illustrate how the weight price algorithm works:

- Consider a bundle that includes the following component lines:

- 1 t-shirt (unit price: $10, quantity: 1, id: 1)
- 2 shorts (unit price: $20, quantity: 2, id: 2)
- 3 socks (unit price: $30, quantity: 3, id: 3)

- The weight of each component line is calculated as follows:

- T-shirt: $10 * 1 = $10
- Shorts: $20 * 2 = $40
- Socks: $30 * 3 = $90

- The total weight of all component lines is calculated as:

- $10 (t-shirt) + $40 (shorts) + $90 (socks) = $140

- Finally, the weight price algorithm allocates the final bundle price to each component line based on its weight. For example, if the amount to be allocated is $100, the allocation would be as follows:

- T-shirt: (10 / 140) * $100 = $7.14
- Shorts: (40 / 140) * $100 = $28.57
- Socks: (90 / 140) * $100 = $64.29

This way, the weight price algorithm ensures that each component line in the bundle receives a fair portion of the final bundle price, based on its individual weight.

## Weighted Price Algorithm with Discounts

**Overview**

When purchasing a product bundle through our Simple Bundles App, you might have noticed that the allocation of the total bundle price to individual items changes when a discount is applied. While our app initially allocates the price based on the weight of each item, applying a discount can lead to unpredictable pricing distributions for each item, sometimes even reducing the price of an item to a negligible amount, like $0.01 or even $0.

Let’s dive into this a bit deeper:

**Default Weighted Price Algorithm**

Under normal circumstances, without any discounts, the app uses a weighted price algorithm to fairly distribute the total price of the bundle across the individual items based on their weight. The weight of an item is its unit price multiplied by its quantity.

**Discounts and Their Impact**

However, when a discount is applied to the total bundle price, the weighted price allocation gets disrupted. Instead of distributing the discounted amount across all items in the bundle proportionately, Shopify might deduct the entire discount from only a few items, leaving their price extremely low or even zero, while other items retain their original price.

This behavior is not ideal, and Shopify is actively looking into refining this price allocation method to make it more consistent and fair. But for now, it's important to understand this behavior when reviewing your order summary.

**Example**

To illustrate this, let's look at the provided example:

__Original Order without Discount__

You purchase the "Traveler's Delight" bundle priced at 179.94 which includes equally priced items:

- 2 units of "Sunset Perfume" priced at $19.99 each (due to the penny problem)
- 3 units of "Ocean Breeze Perfume" priced at $19.99 each (due to the penny problem)
- 1 unit of "Mountain Air Perfume" priced at $20.00
- 1 unit of "Desert Sand Perfume" priced at $20.00
- 2 units of "Forest Trail Perfume" priced at $19.99 each (due to the penny problem)

The subtotal for these 9 items comes to $179.94.

__Applying the "BFCM" Discount__

On applying the "BFCM" discount, a total of $59.98 is deducted. However, instead of this amount being evenly distributed across all items, the entire discount is deducted only from the "Ocean Breeze Perfume" and "Forest Trail Perfume". This results in:

- "Sunset Perfume"
**retaining**its original price of $19.99 each. - "Ocean Breeze Perfume" getting
**reduced**to $0 for 3 units. - "Mountain Air Perfume"
**retaining**its original price of $20.00. - "Desert Sand Perfume"
**retaining**its original price of $20.00. - "Forest Trail Perfume" getting
**reduced**to $19.98 for 2 units in total.

Consequently, the final amount you pay after the discount is $119.96.

While this may seem confusing, it's essential to remember that the total discount is always correctly applied to your order, but the distribution of the discounted amount across individual items can vary.

**Conclusion**

It's crucial to understand the nuances of the weighted price algorithm, especially when discounts come into play. Rest assured, as Shopify continues to improve its platform, we can expect even more refined and predictable pricing distributions in the future.