Skip to content

Unable to calculate shipping rates. #92

@MateoLa

Description

@MateoLa

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions