Search code examples
ruby-on-railsrubyruby-on-rails-5spree

LineItem adjustment doesn't affect Order total price Spree


I'm building an app using Spree 3.6.6 where i need to make Line item adjustment, i'm using the below code

line_item = Spree::LineItem.find(id)
line_item.adjustments.create!(
  amount: 6,
  order: line_item.order,
  label: 'Test',
  adjustable: line_item
)

however the line item adjustment is being created successfully, but the total price of the order doesn't change, what may be the error ?


Solution

  • You can force your order to update totals with order.update_with_updater!