mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
reload line items and recalculate fees after removing line item
This commit is contained in:
@@ -62,7 +62,12 @@ class SubscriptionPlacementJob < ActiveJob::Base
|
||||
unavailable_stock_lines_for(order).each do |line_item|
|
||||
changes[line_item.id] = changes[line_item.id] || line_item.quantity
|
||||
line_item.update(quantity: 0)
|
||||
Spree::OrderInventory.new(order).verify(line_item)
|
||||
|
||||
Spree::OrderInventory.new(order).verify(line_item, order.shipment)
|
||||
end
|
||||
if changes.present?
|
||||
order.line_items.reload
|
||||
order.update_order_fees!
|
||||
end
|
||||
changes
|
||||
end
|
||||
|
||||
@@ -98,8 +98,7 @@ module Spree
|
||||
inventory_unit.destroy
|
||||
removed_quantity += 1
|
||||
end
|
||||
|
||||
shipment.destroy if shipment.inventory_units.count == 0
|
||||
shipment.destroy if shipment.inventory_units.reload.count == 0
|
||||
|
||||
# removing this from shipment, and adding to stock_location
|
||||
if order.completed?
|
||||
|
||||
Reference in New Issue
Block a user