Add order.shipments reload to line_item.update_inventory. This is necessary when destroying line items as update_inventory may delete the shipment from the order

This commit is contained in:
luisramos0
2018-12-23 00:23:49 +00:00
parent 26b5250f2c
commit b83ec8d357

View File

@@ -132,6 +132,10 @@ Spree::LineItem.class_eval do
def update_inventory_with_scoping
scoper.scope(variant)
update_inventory_without_scoping
# This is required because update_inventory may delete the last shipment in the order
# and that makes update_order fail if we don't reload the shipments relation here
order.shipments.reload
end
alias_method_chain :update_inventory, :scoping