Class: Spree::Shipment

Inherits:
Object
  • Object
show all
Includes:
SolidusBactracs::Spree::ShipmentDecorator
Defined in:
lib/generators/solidus_bactracs/install/templates/initializer.rb

Instance Method Summary collapse

Methods included from SolidusBactracs::Spree::ShipmentDecorator

prepended, #verify_bactracs_sync!

Instance Method Details

#normalize_valid_variants_from_bundlesObject



101
102
103
104
105
106
107
108
109
110
# File 'lib/generators/solidus_bactracs/install/templates/initializer.rb', line 101

def normalize_valid_variants_from_bundles
  self.line_items.reduce([]) do |variants, line_item|
    if line_item.product.respond_to?(:assembly?) && line_item.product.assembly?
      variants += line_item.product.parts.reject(&:invalid_part?)
    else
      variants << line_item.variant
    end
    variants
  end
end