Error with USPS shipping

I have enabled the USPS plugin and contacted the postal service to switch my account over to the production server. However, I am not seeing shipping being calculated for an order and am seeing the following two errors in my log when getting to the confirm-checkout step:

[Fri Apr 20 10:55:38 2012] [error] [client <ip_removed>] PHP Warning: Invalid argument supplied for foreach() in /var/www/html/wp-content/plugins/marketpress/marketpress-includes/plugins-shipping/mp-usps.php on line 492, referer: https://<host_removed>/store/cart/checkout/
[Fri Apr 20 10:55:38 2012] [error] [client <ip_removed>] PHP Warning: Invalid argument supplied for foreach() in /var/www/html/wp-content/plugins/marketpress/marketpress-includes/plugins-shipping/mp-usps.php on line 793, referer: https://<host_removed>/store/cart/checkout/

Any idea what might be causing this?

Thanks.

  • 3SixtyEvolve
    • New Recruit

    Greetings @dnoguero

    Thank you for being a member of our community and for posting to the forum.

    I had a look at my test site to see what are the basic requirements and would just like to go through it with you to make sure we didn't miss any steps:

    1) Using this USPS Shipping calculator requires requesting an Ecommerce API Username and Password. Get your free set of credentials here » https://secure.shippingapis.com/registration/
    2) Test and then Activate your credentials with USPS before going live.
    3) Select the USPS Request Mode
    4) Select your offered USPS Offered Domestic Services
    5) Select your offered USPS Offered International Services

    If all of these are in place it should work fine, however, if you are facing this error it might be useful to also get in contact with USPS to see if there is a problem on their side. One of our other members placed a post that ties in well with what your trying to do: USPS Set Up Solution

    Please let me know if you have all of the above 5 steps in place and if you verified with USPS that there is no problem on their side. Sorry for the process of elimination, but this will help us to find where the problem could lie.

    Thank you for your cooperation and I look forward to your feedback.

    Have a good weekend :slight_smile:

    Gina

  • Dean Kaus
    • The Bug Hunter

    Hi @dnoguero and @GinaB

    My first concern here is that you said that you enabled the USPS plugin. If you in fact do have a USPS plugin installed I'd say that would be your problem right there. If so then remove it and see what happens.

    @Aarun if I understand correctly has built the USPS shipping calculator directly into Marketpress so there would be no need for another shipping plugin.

    GinaB gave great advice here and it's important to make sure you cut and paste the API USERNAME and Not the password. I first had a few problems as I had a blank space at the end of the API so make sure you only paste the actual code.

    IMPORTANT! Make sure you copy and past the USPS Username and NOT the Password (took me a while to catch that one) Most importantly don't follow the instructions on testing as specified in the USPS email you received with your credentials.

    In the following thread the last post I made about what you did and didn't need to do.
    https://premium.wpmudev.org/forums/topic/setting-up-the-usps-api

    Make sure you select the retail shipping rate and leave the default settings for the package sizes and be sure to SAVE at the bottom of the page.

    I think that if you have followed all of the steps and still have a problem, then I'd try to reinstall marketpress.

    Hope that helps and you get up and running!

  • dnoguero
    • Flash Drive

    Thanks for chiming in @GinaB and @Dean. I verified that all my settings were correct as per the above posts.

    After debugging the code, It turns out the base zip/postal code was not set in the Store Settings/General section. The USPS web service call was returning an error response that was getting ignored by the plugin code. It would be really helpful if the plugin could report errors that it receives back for troubleshooting purposes. It also might be helpful if something could alert if all required settings are not set.

    As a bigger issue, the shipping plugin allows the order to go through without any shipping costs added if the USPS web service call fails with an error.

  • Dean Kaus
    • The Bug Hunter

    Sorry @dnoguero @GinaB I didn't think to mention the zip code. For some reason I thought that if you had an invalid zip code entered you received a clear message that the originating zip code was invalid.
    As far as letting the error through we need to alert @Aaron about the need to have an error trap set there. Again I didn't experience the errors like you did and my order was not processed.

  • Dean Kaus
    • The Bug Hunter

    Hey @cortbucher Wanted to follow up to see if you were able to resolve your problem with USPS or did you still need help. I you can be more specific on what your having problems with I know that someone will be able to resolve your problem.

    Another way to speed things up in the forums is to check the be notified of follow up posts via email as you will know as soon as someone has answered your questions.

  • aecnu
    • WP Unicorn

    Greetings Everyone,

    We have not heard back from you as to the status of this issue.

    If you are still having an issue please let us know so that we may try to get you fixed up as soon as possible by choosing to check mark this ticket as unresolved below and posting any new errors or symptoms you are noticing.

    This action will also bring your ticket up front back in plain view again within the ticket system.

    Thank you for being a WPMU Dev member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.