Commit c970f4d
Fix mini-cart per-unit price for bulk-priced lines
Bulk (quantity-break) pricing was applied only on woocommerce_before_calculate_
totals. The mini-cart template renders each line's per-unit price BEFORE its
subtotal triggers recalculation, so the per-unit line showed the non-bulk price
(e.g. $595) while the subtotal reflected the bulk price ($575 x qty). The main
cart page, which calls calculate_totals() up front, was unaffected.
Make set_cart_item_price_from_session quantity-aware: restore the price via
effective_price_qty() with the stored line quantity so the cart item already
carries the bulk per-unit price before anything renders. apply_bulk_cart_pricing
still re-applies it on every recalculation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent bdce458 commit c970f4d
2 files changed
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
328 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
329 | 335 | | |
330 | 336 | | |
331 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
116 | 140 | | |
117 | 141 | | |
118 | 142 | | |
| |||
0 commit comments