USPS wrong rates when enable "Use product dimension"

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 7 months ago #341017

-- HikaShop version -- : 4.5.0
-- Joomla version -- : 3.10.8
-- PHP version -- : 7.4.29
-- Browser(s) name and version -- : Any
-- Error-message(debug-mod must be tuned on) -- : None

This has been a long-standing issue that we have been working around for a few years now.

Basically anything length goes over 48 inches length, and USPS comes back wrong (~5 to 7 times too much).

If we stay at 48 or below inches on leght, it is correct.

This happens only in a combination of lengths over 48 inches (even 48.100) AND "Use product dimensions is enabled).

Doesn't matter which First-class Mail type (Package service or Parcel) or even Container (Rectangular or Non rectangular).

We have a few products that are tubes, which are 57 inches in length (57Lx3Wx3H).

When we enter it into postcalc.usps.com, we get the correct amount when dropped off at USPS.

And if we enter the 48-inch length in HikaShop on the product, it comes out to the correct USPS amount.

But if we set the product length to 57 inches in HikaShop, it comes out wrong about 5 to 7 times higher.

Currently, the wrong around we are using is just setting the length to 48 inches and setting the product to a completely different USPS shipping method/warehouse combination from any other product.

We are not breaking the girth limits (should be 108 max with USP) or weight limits (only 3 lbs item).

My guess is something changes in your formula for the dimensions sent to USPS when the length goes above 48 inches.

Is this a bug or is there some setting some where else I'm missing?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 7 months ago #341032

Hi,

That would be hard to say anything definitive without doing some deep debugging.
Could you provide a backend access, a FTP access, a link to the product page, the address to use on the checkout, a screenshot of what you have with that same data on USPS website and any other useful information so that I can reproduce the issue ?
If so please provide all that via our contact form along with a link to this thread:
www.hikashop.com/support/contact-us.html

Please Log in or Create an account to join the conversation.

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 7 months ago #341054

Email sent with details.

By the way, we can reproduce this on another site that is owned by the same company.

Identical setup and workaround in place.

Last edit: 2 years 7 months ago by jazzmang. Reason: letting know there is the 2nd site with the same issue.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 7 months ago #341060

Hi,

Thank you for the backend access and information. However, I would also need a FTP access in order to add debugging code to understand what's going on.
Could you provide that as well please ?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 7 months ago #341077

Hi,

Thank you, I got the FTP access.
However, I'm not able to reproduce the issue on your website.
I first added the product F/STRIP to the cart, and entered the US address you provided and I got the rate of $30

Then, I increased the length from 48 to 57 but instead of getting a rate of $175 like you said I would, I got an error message "Failed to obtain shipping quotes."
So then, I activated the "debug" setting of the shipping method "USPS Specialty Items Excluded from Free Shipping (Tube)" corresponding to the warehouse of that product, and I got an extra error message:

USPS error: -2147219385 The entered dimensions result in the mail piece being oversized and cannot be mailed with the requested mail service.

I also got the request sent to USPS:
<?xml version="1.0"?><RateV4Request USERID="XXXXXXXX"><Revision /><Package ID="1"><Service>PRIORITY</Service><ZipOrigination>XXXX</ZipOrigination><ZipDestination>28358</ZipDestination><Pounds>3</Pounds><Ounces>0</Ounces><Container>RECTANGULAR</Container><Size>Regular</Size><Width>3</Width><Length>57</Length><Height>3</Height><Girth>69</Girth><Machinable>false</Machinable></Package></RateV4Request>
(I hid your USERID and your zip code but the rest is what was sent to USPS)
And as you can see the width/length/height and girth all corresponds to that product dimensions.
And that error message saying that the package is oversized comes directly from USPS, not HikaShop.

So there must be something else I'm missing here to reproduce the issue.
I've reverted the length in the product and turned back off the debug in the shipping method after my tests.
Are you still able to reproduce the issue ? Or do you see the same problem as me ?
Maybe you selected other shipping services in the settings of the shipping method when you did your tests with 57 inches ?

Please Log in or Create an account to join the conversation.

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 7 months ago #341079

Sent, sorry FTP just isn't something we have set up by default so takes some effort to up and wanted to make sure it was absolutely needed first.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 7 months ago #341081

Hi,

You must have missed my previous message. Please read above:
www.hikashop.com/forum/install-update/90...imension.html#341077

Please Log in or Create an account to join the conversation.

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 7 months ago #341083

Sorry I got distracted and didn't hit send immediately on my prior post.

I think I see what happened; I forgot to re-check the retail ground option on the main site.

However, I re-tested. After your debug code, I got a completely different and wrong price (~$250).



I tested the other site, and it works fine (using the workaround).


I also included a screenshot of increasing the length to 57 inches on the other site.


Could something in your debug code cause making it double?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 7 months ago #341084

Also, even the workaround is now wrong on the main site.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 6 months ago #341100

Hi,

I still have 128$ when I change the length to 57 inches.
I also did several tests this morning.
In all my tests, the XML sent to USPS always had the correct dimensions and weight.
So I don't see why USPS would send back a different rate than expected.
I tried to look online to see if they had some kind of debugger where I could provide the XML and it would provide results but to no avail.
So I guess the next step is to contact the support at USPS. Provide them with the XML

<?xml version="1.0"?><RateV4Request USERID="XXXXXXXX"><Revision /><Package ID="1"><Service>PRIORITY</Service><ZipOrigination>XXXX</ZipOrigination><ZipDestination>28358</ZipDestination><Pounds>3</Pounds><Ounces>0</Ounces><Container>RECTANGULAR</Container><Size>Regular</Size><Width>3</Width><Length>57</Length><Height>3</Height><Girth>69</Girth><Machinable>false</Machinable></Package></RateV4Request>

(replacing the USERID and ZipOrigination with the real values of your website and asking them why you get back a retail ground fee at 128$ while on the website you only get 25$ with the same information.

Please Log in or Create an account to join the conversation.

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 6 months ago #341102

How are you getting 69 for the girth??

Per faq.usps.com/s/article/How-is-the-size-a...-a-parcel-determined , Girth calculated by either:

  • For rectangular packages, Girth would be Height multiplied by two plus Width multiplied by two.
  • For cylindrical packages, Girth would be the circumference of the cylinder.

(3x2) + (3x2) = 12.

I'm not sure how you getting to 69.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 6 months ago #341104

Hi,

I think we're onto something here.
From what I can see there is indeed a confusion in the code of the plugin between the girth and the length and girth combination.
The plugin calculates the length and girth combination in order to check for the restriction of USPS:
"Pieces going to a domestic location may not measure more than 108 inches in length and girth combined"
And then, it wrongly use that value as the girth when sending the dimensions information to USPS instead of using the girth only for the girth.
I've made a patch in the plugin and uploaded a new version of the plugin on your website.
I then run a test and I got both "Priority Mail $30.65" and "Retail Ground $30.45" which sounds much better.
If we remove the $5 surplus you had added to the shipping mehtod, we should get the exact shipping fee provided on USPS's calculator tool.
Please check on your end whether it fixes the issue and doesn't create other side effects.

Please Log in or Create an account to join the conversation.

  • Posts: 238
  • Thank you received: 21
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
2 years 6 months ago #341106

Yes, that looks like it is working as expected.

Can we get the code update so we can get this working on the other site as well?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 6 months ago #341107

Hi,

Yes. Here is a copy of the install package for the patched USPS plugin.
We'll include the changes in HikaShop too.

File Attachment:

File Name: usps_2022-04-25.zip
File Size:11 KB

Attachments:
Last edit: 2 years 6 months ago by nicolas.
The following user(s) said Thank You: jazzmang

Please Log in or Create an account to join the conversation.

Time to create page: 0.108 seconds
Powered by Kunena Forum