Quick question — we have some assemblies on our we...
# support
j
Quick question — we have some assemblies on our website and the price of the assembly grows over time. Had an issue this week where a customer had added the assembly to the cart a very long time ago, and was able to checkout with the old price. Is there a built in way to avoid this in solidus so carts always reflect the current state of pricing?
j
It’s easy enough to reset the prices, some stores do that when entering the checkout me stuff
k
another option is deleting non completed orders after a while. This will also cleanup your database with (most likely) useless orders
sg thumbs up 2
j
Since I literally just added this method to the line item decorator in a project, I can provide it here:
Copy code
def reset_price!
  self.money_price = variant.price_for_options(pricing_options)&.money
  save!
end
👌 2
If you were going to call this a lot you'd want to only save if it changed.
j
Nice! Thanks yeah I like that approach I’ll add a little method on checkout to validate the line item prices