-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
The cart does not recalculate automatically when the underlying data such prices changes or the cart is particularly old.
Solidus Version:
All
To Reproduce
- insert a product in the basket
- modify the price of a product in the admin interface or via API
- try to complete an order that was initiated
Current behavior
The cart is not recalculated and therefore the cart still contains the product with the old price.
Expected behavior
Credits for expected behaviour: @forkata
The general idea would be to re-assign the price on line item from the variant on the line item and call order.recalculate.
Clearing the LineItem#price and calling LineItem#set_pricing_attributes would do it as well -
solidus/core/app/models/spree/line_item.rb
Lines 168 to 172 in fc44726
def set_pricing_attributes | |
self.cost_price ||= variant.cost_price | |
self.money_price = variant.price_for_options(pricing_options)&.money if price.nil? | |
true | |
end |
Additional context
@mickenorlen would you be up to make a PR related to this?
User Story:
The client updated the product price a couple of months back. Many orders have bought the product at new price. But all of a sudden there is a customer that buys the product with the old price. This has been reported twice now. What could be the issue here? Are old prices stored somewhere in the application or is it something to do with client specific caching who maybe loaded the product before the price change?