Module: Spree::Stock::PrioritizerDecorator

Defined in:
app/models/spree/stock/prioritizer_decorator.rb

Instance Method Summary collapse

Instance Method Details

#hash_item(item) ⇒ Object

use also line_item to differentiate each package item in case of same variant_id of different line_item with group_buy_id enabled



5
6
7
8
9
10
11
12
13
14
# File 'app/models/spree/stock/prioritizer_decorator.rb', line 5

def hash_item(item)
  shipment = item.inventory_unit.shipment
  variant  = item.inventory_unit.variant
  line_item = item.inventory_unit.line_item
  if shipment.present?
    variant.hash ^ line_item.hash ^ shipment.hash
  else
    variant.hash ^ line_item.hash
  end
end