You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows discounts to be set on the actual quantities which end up in the specific range, with the rest calculated on the full price (or the respective discount set up for that band)
Copy file name to clipboardExpand all lines: README.md
+72-8Lines changed: 72 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,22 @@ Each VolumePrice contains the following values:
15
15
1.**Variant:** Each VolumePrice is associated with a _Variant_, which is used to link products to
16
16
particular prices.
17
17
2.**Name:** The human readable representation of the quantity range (Ex. 10-100). (Optional)
18
-
3.**Discount Type** The type of discount to apply. **Price:** sets price to the amount specified.
19
-
***Dollar:** subtracts specified amount from the Variant price.
20
-
***Percent:** subtracts the specified amounts percentage from the Variant price.
18
+
3.**Discount Type** The type of discount to apply.
19
+
***Price:** sets price to the amount specified for all items
20
+
***Dollar:** subtracts specified amount from the Variant price for all items
21
+
***Percent:** subtracts the specified amounts percentage from the Variant price for all items
22
+
***Banded Price:** sets price to the amount specified, but only for items within the range. For items outside the range it will consult that band to determine price
23
+
***Banded Dollar:** subtracts specified amount from the Variant price, but only for items within the range. For items outside the range it will consult that band to determine price
24
+
***Banded Percent:** subtracts the specified amounts percentage from the Variant price, but only for items within the range. For items outside the range it will consult that band to determine price
21
25
4.**Range:** The quantity range for which the price is valid (See Below for Examples of Valid
22
26
Ranges.)
23
27
5.**Amount:** The price of the product if the line item quantity falls within the specified range.
24
28
6.**Position:** Integer value for `acts_as_list` (Helps keep the volume prices in a defined order.)
25
29
30
+
Note: when using percentage based or banded discounts then first the system will calculate a per-item price, and then get the total by multiplying the per-item price with the quantity. Due to rounding this can differ if the price would have been calculated on the total.
31
+
32
+
Example: Percent discount is 10%, Original price is 9.99, Ordering 100 pieces. Per-item price is rounded down to $8.99 (from $8.991), so total will be $899.00 instead of $899.10
33
+
26
34
## Install
27
35
28
36
The extension contains a rails generator that will add the necessary migrations and give you the
@@ -99,12 +107,68 @@ Cart Contents:
99
107
| ------- | -------- | ----- | ----- |
100
108
| Rails T-Shirt | 20 | 17.99 | 359.80 |
101
109
102
-
## Additional Notes
110
+
## Banded Examples
111
+
112
+
Consider the following examples of volume prices:
113
+
114
+
| Variant | Name | Type | Range | Amount | Position |
| Rails T-Shirt | 20 or more | Banded Percent | (20+) | 75% | 4 |
120
+
121
+
### Example 1
122
+
123
+
Cart Contents:
124
+
125
+
| Product | Quantity | Price | Total |
126
+
| ------- | -------- | ----- | ----- |
127
+
| Rails T-Shirt | 1 | 19.99 | 19.99 |
128
+
129
+
### Example 2
130
+
131
+
Cart Contents:
132
+
133
+
| Product | Quantity | Price | Total |
134
+
| ------- | -------- | ----- | ----- |
135
+
| Rails T-Shirt | 5 | 19.99 | 99.95 |
136
+
137
+
### Example 3
138
+
139
+
Cart Contents:
140
+
141
+
| Product | Quantity | Price | Total |
142
+
| ------- | -------- | ----- | ----- |
143
+
| Rails T-Shirt | 6 | 18.99 | 113.94 |
144
+
145
+
### Example 4
146
+
147
+
Cart Contents:
148
+
149
+
| Product | Quantity | Price | Total |
150
+
| ------- | -------- | ----- | ----- |
151
+
| Rails T-Shirt | 10 | 18.09 | 180.90 |
152
+
153
+
Items #1-9 will be priced according to the `(5..9)` rule as it is unbanded. Their price will be $170.91
154
+
155
+
Item #10 will be priced according to the `(10+)` rule, which describes a 50% reduction to the base price, which is $9.99 (rounded down)
156
+
157
+
### Example 5
158
+
159
+
Cart Contents:
160
+
161
+
| Product | Quantity | Price | Total |
162
+
| ------- | -------- | ----- | ----- |
163
+
| Rails T-Shirt | 20 | 13.79 | 275.80 |
164
+
165
+
Items #1-9 will be priced according to the `(5..9)` rule as it is unbanded. Their price will be $170.91
166
+
167
+
Items #10-19 will be priced according to the `(10-19)` rule, which describes a 50% reduction to the base price. This equates to $9.99 per item (rounded down)
168
+
169
+
Item #20 will be priced according to the `(20+)` rule, which describes a 75% reduction to the base price. This would be $4.99 (rounded down)
103
170
104
-
* The volume price is applied based on the total quantity ordered for a particular variant. It does
105
-
not apply different prices for the portion of the quantity that falls within a particular range.
106
-
Only the one price is used (although this would be an interesting configurable option if someone
107
-
wanted to write a patch.)
171
+
A per-item price of $13.79 is calculated (rounded down from $13.792875), then multiplied by the quantity getting $275.80. Note: this is $0.05 lower than what you would get if you total up the items separately, see notes above.
0 commit comments