Merge decorator OrderUpdater

This commit is contained in:
Luis Ramos
2020-07-10 16:49:11 +01:00
parent ebeeeb7ed3
commit 5b3fbe0aed
2 changed files with 3 additions and 13 deletions

View File

@@ -28,7 +28,7 @@ module Spree
end
update_promotion_adjustments
update_shipping_adjustments
update_all_adjustments
# update totals a second time in case updated adjustments have an effect on the total
update_totals
@@ -137,10 +137,8 @@ module Spree
choose_best_promotion_adjustment
end
# Shipping adjustments don't receive order on update! because they calculated
# over a shipping / package object rather than an order object
def update_shipping_adjustments
order.adjustments.reload.shipping.each(&:update!)
def update_all_adjustments
order.adjustments.reload.each(&:update!)
end
def before_save_hook

View File

@@ -1,8 +0,0 @@
# frozen_string_literal: true
Spree::OrderUpdater.class_eval do
# Override spree method to make it update all adjustments as in Spree v2.0.4
def update_shipping_adjustments
order.adjustments.reload.each(&:update!)
end
end