Closed johnj24 closed 1 year ago
You certainly can, I just haven't put together an example for it. The tricky part is that most providers really require you to provide a bunch of details on customer addresses, to provide accurate pricing. Ideally, if we can just ask for a postcode, that'd be best, which is a popular method I've seen on shops.
I can put together an example for you after I've tested the accuracy of these calls to providers, just supplying the postcode.
Sounds great. Thanks, Josh.
@engram-design Running into the same issue, we need to estimate shipping addresses based on zipcode. Could you post or send the code example?
There's no example code for this, because I'd have to create a new endpoint for shipping estimation.
However, since posting this issue, I believe Commerce has its own "Estimate Cart Addresses" functionality. I've not looked into it at length, but it might be an option - https://craftcms.com/docs/commerce/3.x/addresses.html#estimate-cart-addresses
@engram-design What changed from your response to the OP on November 9? It seemed like you did have a solution then? Or did it not end up working out?
@jacobrussell Nothing has changed, I just haven't had the chance to put together a full example. It was purely conceptual and not sure if I'd have need a custom controller. But Commerce's estimate cart addresses seems the way to go.
With Postie, is it possible to provide the customer a shipping estimate before an address has been added to the cart? I can't seem to find any great examples of this, so perhaps its not possible. Prior to Postie, I manually created a shipping method in Commerce settings with "Anywhere" as a shipping zone just to give the customer a sense of what it could cost.