Open dpritchett opened 11 years ago
Amendment: We should probably let store admins decide whether their :origin
is commercial or residential via a checkbox in the active shipping admin template alongside the other origin settings such as origin zip code.
There has been some discussion to take origin from stock_location for shipping calcs. I know that UPS can determine if the address is residential or commerical. Do these exist in the API for Fedex so that we could set them on the fly during the shipment creation?
The FedEx API docs do claim they have an "Address Validation Service" which can - among other things - "Determine whether an address is business or residential to increase the accuracy of courtesy rate quotes. Applies to U.S. addresses only." I'm quoting this from a PDF I could only find after creating an account and logging in to their dev portal.
Edit: Filename is DeveloperGuide2012.pdf
@dpritchett is this still an issue?, I think I've read somewhere upstream over at Shopify/active_shipping that this was a problem
@dpritchett @mrpollo The address form already offers a company name field. If that field is filled in and we provide a company name, can we set the address type to commercial?
Another other option is to modify the address form and add a checkbox asking if the address is residential or commercial.
Note this will need to be done in base because UPS uses the same logic and will always default to residential.
I think it's more of a feature request at this point, but it is something that should be support one way or the other.
I like FineLine's take on it! If the company field is set, default to commercial. Personally I just hardcoded mine to commercial everywhere and I feel bad about it.
Issue Description
I'd like to make FedEx Ground shipments via Spree. The
:compute
method in our base class here generates ActiveShipping Location objects without specifying an :address_type, which means that ActiveShipping eventually treats them as Residential shipments :house_with_garden:. FedEx only delivers Ground shipments to businesses, reserving a separate "Ground Home Delivery" for residential destinations. We'd really like to be able to send appropriate B2B shipments :factory:.First,
spree_active_shipping
generatesLocation
objects without specifying:address_type
From the Base calculator:
Next, ActiveShipping instantiates the new Location objects with
nil
for an:address_type
, which means it will never be:commercial?
From ActiveMerchant::Shipping::Location
Finally, ActiveShipping's FedEx request defaults to 'Residential' in the absence of a specified
:commercial?
:address_type
From ActiveMerchant::Shipping::Fedex:
... and FedEx only returns residential shipping options as per their docs linked above.
Proposed Resolution
origin
object, pass anaddress_type: 'commercial
to ActiveShipping. Spree stores are inherently commmercial.destination
object, setaddres_type
to'commercial'
or'residential'
as appropriate. This leads to...Thanks everyone! :thumbsup:
cc @jdugan