Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Checkout Page (to post_code null) throws error #20

Open
Tw0bit opened this issue Jun 6, 2019 · 4 comments
Open

Checkout Page (to post_code null) throws error #20

Tw0bit opened this issue Jun 6, 2019 · 4 comments

Comments

@Tw0bit
Copy link

Tw0bit commented Jun 6, 2019

When a user gets to the checkout page without a postcode for ship to, the following error occurs:

Internal Error. Details are available in Magento log file. Report ID: webapi-5cf8ebbdf2c67

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?

@chnorton
Copy link
Member

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.

@Tw0bit
Copy link
Author

Tw0bit commented Oct 31, 2019

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:

  1. They enter the website and add a product to cart.
  2. They head to the cart page and have a look at it (does not enter anything into estimate part)
  3. When they return to the website and everytime they try add a product they get an error "We can't add this item to your shopping cart right now." if the postcode is blank on the cart estimate area
  4. Adding a postcode to the shipping estimate on the cart page fixes this issue; also if they do not view the cart page at all until checkout it doesnt occur.

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)"} []

@Tw0bit
Copy link
Author

Tw0bit commented Oct 31, 2019

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;
}

@xeontcs
Copy link

xeontcs commented Apr 25, 2020

@Tw0bit Thank you! You saved lots of my time

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

No branches or pull requests

3 participants