Open Tw0bit opened 5 years ago
This isn't a situation we've come across, as postcodes are typically required before reaching the carrier selection. In what situations is a customer able to select Auspost shipping without having had to enter a postcode?
Have you come across any other carriers that handle this? If so, it would be good to take a look at what they're doing.
Hi Chris,
Sorry its been a while since I got onto this issue... The issue is occuring on the "Estimate Shipping and Tax" portion of the website when viewing the cart.
The workflow for our customer is:
The error in the magento exception.log is: 2019-10-31 01:39:56] main.CRITICAL: Client error response [status code] 404 [reason phrase] Not Found [url] https://digitalapi.auspost.com.au/postage/parcel/domestic/service?from_postcode=4000&to_postcode=0&length=30&width=30&height=20&weight=0.4 {"exception":"[object] (Guzzle\Http\Exception\ClientErrorResponseException(code: 0): Client error response [status code] 404 [reason phrase] Not Found [url] https://digitalapi.auspost.com.au/postage/parcel/domestic/service?from_postcode=4000&to_postcode=0&length=30&width=30&height=20&weight=0.4 at /home/account/public_html/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43)"} []
The "fix" I put in:
Line 447 of /australia-mage2/Model/Shipping/Carrier/AustraliaPost.php if ((int)$config['to_postcode'] == 0 || ($config['to_postcode'] == null)) { return $rateResult; }
@Tw0bit Thank you! You saved lots of my time
When a user gets to the checkout page without a postcode for ship to, the following error occurs:
The logged error: https://digitalapi.auspost.com.au/postage/parcel/domestic/service?from_postcode=4000&to_postcode=0&length=30&width=30&height=20&weight=0.1 at vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43)"} []
So the AusPost API is erroring out with a null postcode. How can we prevent the system fetching rates when no postcode?