Shopify / active_shipping

ActiveShipping is a simple shipping abstraction library extracted from Shopify
http://shopify.github.io/active_shipping
MIT License
812 stars 546 forks source link

Multi-piece shipment support? #486

Open johnnncodes opened 7 years ago

johnnncodes commented 7 years ago

Does activeshipping gem supports creating of multi-piece shipment?

Example:

Our customer orders 2 pieces of item X. When we ask UPS/Fedex to ship the order of the customer, we need UPS/Fedex to give us 2 shipping labels instead of just 1 shipping label. Is there a way to do this using ActiveShipping gem?

developingchris commented 7 years ago

If you perform a rate request with 2 packages, it will rate them as being on a single label (sometimes called master label). So you just need to do 2 separate find_rates calls with your separate packages.

Then the per label surcharges will be applied to each and sum the results by the service code to see the overall shipping price.

So yes, the gem supports this, the api's by the carriers don't make it a single api call.

johnnncodes commented 7 years ago

@developingchris Thanks for the response.

So for example our customer orders 2 pieces of item X, this is what we need to do:

response1 = ups.find_rates(origin, destination, package_x) # quantity of package_x is 1
response2 = ups.find_rates(origin, destination, package_x) # quantity of package_x is 1

# sum the rates of response1 & response2 by service code (Example: UPS Standard)

Is that correct?

Before you responded to my question, this is what we're doing btw:

packages = [package_x, package_x]
response = ups.find_rates(origin, destination, packages)

Since the customer orders 2 pieces of item x, instead of passing packages = [package_x] with quantity of 2, we're passing packages = [package_x, package_x] with package_x having quantity of 1.

Wouldn't it give the same result with your suggestion above?

developingchris commented 7 years ago

so if you pass both packages to a single call. Then the shipping company will put both boxes on a single label. The carriers in my experience have a base fee per label. So it depends on how you want to pay for the labels. If the customer needs to pay the base fee on both boxes, then you need to do the merge way. If you want to provide the cheapest options available they can be a single label with "box 1 of 2" "box 2 of 2" labels on them as a set. In that case you would use what you are doing, passing 1 packages into the rate quote.

@jonathankwok has been looking into the idea of a Shipment concept which would make this more clear.