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

Unable to calculate shipping rates. #92

Open
MateoLa opened this issue Nov 8, 2019 · 2 comments
Open

Unable to calculate shipping rates. #92

MateoLa opened this issue Nov 8, 2019 · 2 comments

Comments

@MateoLa
Copy link

MateoLa commented Nov 8, 2019

When no shipment methods are assigned to vendor, any order with items from that vendor will fail in the shippment state with the error "We are unable to calculate shipping rates for the selected items".

The origin for that issue its in the package_decorator.rb when you override the shipping methods:

  def shipping_methods
    if (vendor = stock_location.vendor)
      vendor.shipping_methods.to_a
    else
      shipping_categories.map(&:shipping_methods).reduce(:&).to_a
    end
  end

May be you could replace this code to allow the "default" shippments methods for any vendor unless some specific method are assigned to it. Something like this:

  def shipping_methods
    if ( (vendor = stock_location.vendor) && vendor.shipping_methods.present? )
      vendor.shipping_methods.to_a
    else
      shipping_categories.map(&:shipping_methods).reduce(:&).to_a
    end
  end

I think this is the fast solution right now but the appropriate one would be to modify the models to assign shipping methods to vendors (and not vendors to shipping_methods)

@poudelprakash
Copy link
Contributor

@MateoLa But there is no ui to assign vendors to shipping methods as well right?

I had to add shipping method to vendor from rails console to make it work

@MateoLa
Copy link
Author

MateoLa commented Nov 19, 2020

You must log in as vendor and create your own shipping methods in the backend.

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