Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commerce Shipping Estimator #147

Open
nealmckinney opened this issue Nov 18, 2024 · 8 comments
Open

Commerce Shipping Estimator #147

nealmckinney opened this issue Nov 18, 2024 · 8 comments
Labels

Comments

@nealmckinney
Copy link

Question

FIrst time trying Postie, so far got it all working with the stock Commerce 4.7.0 example templates, but the Shipping Estimator appears to be broken now. Anyone else run into this and have a solution to the form? verbb\postie\helpers\ShippyHelper::toAddress(): Argument #2 ($address) must be of type craft\elements\Address, null given, called in /var/www/html/vendor/verbb/postie/src/services/Service.php on line 55

Additional context

No response

@engram-design
Copy link
Member

Fixed for the next release. To get this early, run composer require verbb/postie:"dev-craft-4 as 4.0.9".

@nealmckinney
Copy link
Author

Thanks for the quick fix, but I'm now getting this error: verbb\shippy\models\Address::setFirstName(): Argument #1 ($firstName) must be of type string, null given, called in /var/www/html/vendor/verbb/shippy/src/models/Model.php on line 43

I tried adding a field to the Shipping Estimator form with a pre-filled value but it didn't seem to make a difference:

@engram-design
Copy link
Member

Just pushed another fix for that. You can run composer require verbb/postie:"dev-craft-4 as 4.0.9" again.

@nealmckinney
Copy link
Author

It's not throwing any errors now, but it's returning $0 for the shipping estimate. I peaked at the log file and I see the zip from the form but not the State, log attached.
postie-2024-11-19.log

This is what the State field looks like in the Shipping estimator:

@nealmckinney
Copy link
Author

Oops the field markup didn't come across: <input type="text" id="estimatedShippingAddress-administrativeArea" class="js-address-administrativeArea w-full border border-gray-300 hover:border-gray-500 px-4 py-2 leading-tight rounded" name="estimatedShippingAddress[stateValue]" data-modelname="estimatedShippingAddress">

@engram-design
Copy link
Member

Looks like that's an issue with method.priceForOrder(cart). Switching to method.getPrice() is working. Looking into why that's the case though.

As for the state being empty, that actually looks like a Commerce issue, as the Address model's state value isn't populated, so we'll have to raise an issue there for that one.

@hassanmah
Copy link

@engram-design I get the same error using 5.0.7

verbb\postie\helpers\ShippyHelper::toAddress(): Argument #2 ($address) must be of type craft\elements\Address, null given, called in /Users/hassanmahmood/Documents/krafft/develop/krafft/mm-engineering-services/deploy/vendor/verbb/postie/src/services/Service.php on line 62

@engram-design
Copy link
Member

Fixed for Craft 5. You can run composer require verbb/postie:"dev-craft-5 as 5.0.7".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants