spree_multi_vendor icon indicating copy to clipboard operation
spree_multi_vendor copied to clipboard

Unable to calculate shipping rates.

Open MateoLa opened this issue 5 years ago • 2 comments

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)

MateoLa avatar Nov 08 '19 18:11 MateoLa

@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

poudelprakash avatar Nov 19 '20 01:11 poudelprakash

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

MateoLa avatar Nov 19 '20 20:11 MateoLa