Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping methods determination ignore shipping category of assembly #104

Open
romul opened this issue Feb 12, 2015 · 1 comment
Open

Shipping methods determination ignore shipping category of assembly #104

romul opened this issue Feb 12, 2015 · 1 comment

Comments

@romul
Copy link

romul commented Feb 12, 2015

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?

@JDutil
Copy link
Member

JDutil commented Feb 12, 2015

looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants