lib/spree/retailops/rop_order_helper.rb
# Create a single package virtually containing all of the items of this order to recalculate a shipping price using the order's rules.  Note that this
# bypasses the usual checks for availability and zone that usually happen prior to an invocation of a shipping calculator; hopefully this will not cause
# problems.  It does not account for shipping tax and is probably unsuitable for use with "active shipping" type solutions.
Create a single package virtually containing all of the items of this order to recalculate a shipping price using the order's rules.  Note that this
bypasses the usual checks for availability and zone that usually happen prior to an invocation of a shipping calculator; hopefully this will not cause
problems.  It does not account for shipping tax and is probably unsuitable for use with "active shipping" type solutions.
Create a single package virtually containing all of the items of this order to recalculate a shipping price using the order ' s rules . Note that this bypasses the usual checks for availability and zone that usually happen prior to an invocation of a shipping calculator ; hopefully this will not cause problems . It does not account for shipping tax and is probably unsuitable for use with " active shipping " type solutions .
def calculate_ship_price
        contents = []
        stock_location = nil
        method = nil
        @order.shipments.order(:id).each do |ship|
          pkg = ship.to_package
          meth = ship.shipping_method
          if meth && !meth.calculator.is_a?(Spree::Calculator::Shipping::RetailopsAdvisory)
            method ||= meth
            stock_location ||= pkg.stock_location
          end
          contents += pkg.contents
        end
        return method && method.calculator.compute(Spree::Stock::Package.new( stock_location, @order, contents ))
      end
def calculate_ship_price contents = [ ] stock_location = nil method = nil @order . shipments . order ( :id ) . each do | ship | pkg = ship . to_package meth = ship . shipping_method if meth && ! meth . calculator . is_a? ( Spree :: Calculator :: Shipping :: RetailopsAdvisory ) method ||= meth stock_location ||= pkg . stock_location end contents += pkg . contents end return method && method . calculator . compute ( Spree :: Stock :: Package . new ( stock_location , @order , contents ) ) end
Create a single package virtually containing all of the items of this order to recalculate a shipping price using the order's rules.
Create a single package virtually containing all of the items of this order to recalculate a shipping price using the order ' s rules .
# this is a legit shipping method that can be used for recalculation