spree-product-assembly icon indicating copy to clipboard operation
spree-product-assembly copied to clipboard

Shipping methods determination ignore shipping category of assembly

Open romul opened this issue 10 years ago • 1 comments

Package#shipping_methods https://github.com/spree/spree/blob/3-0-stable/core/app/models/spree/stock/package.rb#L68 is based on parts shipping categories, but store owner can set separate shipping category for assembly itself.

I propose to override https://github.com/spree/spree/blob/3-0-stable/core/app/models/spree/stock/package.rb#L64..L66 with:

module Spree
  module Stock
    Package.class_eval do
      def shipping_categories
        contents.map { |item| item.line_item.variant.shipping_category }.compact.uniq
      end
    end
  end
end

What do you think about it?

romul avatar Feb 12 '15 15:02 romul

looks good to me

JDutil avatar Feb 12 '15 18:02 JDutil