module Spree
  module Stock
    class InventoryUnitBuilder
      def initialize(order)
        @order = order
      end

      def units
        @order.line_items.flat_map do |line_item|
          line_item.quantity.times.map do |i|
            @order.inventory_units.includes(
              variant: {
                product: {
                  shipping_category: {
                    shipping_methods: [:calculator, { zones: :zone_members }]
                  }
                }
              }
            ).build(
              pending: true,
              variant: line_item.variant,
              line_item: line_item,
              order: @order
            )
          end
        end
      end
    end
  end
end

module Spree
  module Stock
    class InventoryUnitBuilder
      def initialize(order)
        @order = order
      end

      def units
        @order.line_items.flat_map do |line_item|
          line_item.quantity.times.map do |i|
            @order.inventory_units.build(
              pending: true,
              variant: line_item.variant,
              line_item: line_item,
              order: @order
            )
          end
        end
      end
    end
  end
end

Remove attempt to eager load InventoryUnitBuilder
Remove attempt to eager load InventoryUnitBuilder

includes have no effect on a .build, so this was doing nothing.

This partially reverts commit a7b3874013266b5804721f81cef83a6f1a1c42a6.
