Advanced Shipping – a USPS Fix

Hello everyone,

Firstly allow me to apologize for the lack of communication in respect to the USPS API changes. I know it must seem like such an amazingly simple thing to fix, but it was not. There were a few fixes by some community members on the forums but they were not robust enough to be implemented into core for an update. I would like to thank @petminky for his contributions and helping forum members facing USPS problems.

One of our local Shipping Guru’s @ecsquest, has been working on an Advanced Shipping Plugin for WP e-Commerce which will be integrated into 3.8 / 3.9 depending on time constraints. Part of that project involved providing a better USPS integration. This doesn’t mean he’s tweaked USPS, oh no, he’s re-written the entire thing! He has been working hard on this for the last month or so, and has been pulling a few all nighters to get this out as quickly as possible. So on behalf of the entire WP e-Commerce community I would like to thank Greg Gullet aka @ecsquest for his dedication and perseverance!

With that out of the way I would like to introduce…

Advanced Shipping Plugin v 0.3.0 – Beta 1

Important things to note: For USPS you must now have dimensions set on all products if you are going to use international shipping. The new USPS API requires this and with the implementation of ASH (Advanced Shipping) this is now possible and necessary.

Also, you can now take advantage of this system for US Domestic rating by choice, and another change is in how the user information is stored. With that in mind its time to update your site! Please back up (write down/ copy paste) your existing USPS User ID as it will not be picked up by USPS 2.0 from where the existing 1.0 system stores it.

USPS Version 2.0 details

  • Uses the new RateV4 API for US Domestic shipping rates
  • Uses the new IntlRateV2 API for International shipping rates
  • New Advanced shipping in use for Internation shipping and optional for US Domestic rating
  • Each item in the cart is rated as its own package. This provides the most accurate rate possible because it uses the dimensions as set on your product (Height, Width, Lenght and Weight) instead of using the total weight only. You will get a more accurate rate every time.
  • USPS Password is no longer needed and has been removed from the interface
  • Added link to the USPS webtools registration page
  • Added checkbox to select using Advanced Shipping for US Domestic rating
  • Added ability to control selected services via the admin panel
  • Added international package type selection
  • Added first class mail type selection

How it works (USPS):

  • Simply add Advanced Shipping Plugin into your Plugins Directory and activate it like any other Plugin.
  • Navigate to your Settings>Shipping page you will see a new USPS 2.0 option.
  • Deselect your old USPS option and select the new USPS 2.0 option
  • Click Edit to configure your USPS integration
  • Test your new integration by adding some products to cart and proceeding to checkout.

Try it out Now !

? Download Advanced Shipping 0.3.0
? Download Advanced Shipping 0.3.1

58 responses... add one

First of all I’d like to take my hat off to Greg for making this happen. This is an awesome new addition to the WP e-Commerce family. The second person in line for copious amounts of kudos is Mr Ghazally our resident WPEC guru for helping Greg get this out the door – gentleman I salute you!

Thanks for the update! Hoping to launch a store in the next day or so for a client and this was starting to get frustrating :-).

Just a heads up – I installed the plugin and got the error – “The plugin does not have a valid header.”

This can be fixed by adding the line:

## Tested up to: 3.1

(or whichever version of WordPress you’re running – I went with 3.1 so it’ll be ready when the new version is released)

In the top box of text in the Readme.txt file.

When changing the quantity of an item – I’m now receiving this error when I click update:

Fatal error: Cannot use object of type ASH as array in …wp-content/plugins/wpec_ash_0.3.0/includes/shipping.helper.php on line 557

I really appreciate the fix but I am having issues with the Domestic Priority USPS side of the plug-in –

No matter what weight and size I put in the product fields the shipping will not adjust for domestic priority shipping.

International priority is updating just fine – Anybody else having this issue?

Also is it possible to keep the USPS first class mail option from appearing? I would like to use only express and priority.

Thanks again for the fixes and in advance for any help!

@Jonathan Blundell
1: I’ll make that change in the header for future releases, thanks!
2: I’ll get on checking that error ASAP

1: What do you mean will not adjust, do you mean the rate is not changing for Priority ?
2: You configure what options are showing using the check boxes in the USPS edit screen, just uncheck the First Class box.

Please contact me directly at my website ( ) VIA the contact form if you need a quick response :), I don’t lurk the forums / blog often but I will be trying to at least this week.

…also, how does the plug-in access our USPS account without a password? (or is that not needed anymore?)
I only ask because the old shipping module required an account number and password…

The password is no longer needed with the new API, only the ID.

You are also getting the error when you change the quantity of an item ? I have been trying to replicate the issue but I am as yet unable to 🙁 Is it possible to grant me access to your admin panel so I can see how you are set up / what might be different ? I can throw in a debug print or two and possibly track down the root of the problem. Just contact me via my contact form at ( )

Thanks all, keep the feedback coming ! Good bad and the ugly bugs.

When press “add to cart” button, ” Updating cart…” kept showing up on screen and won’t go away on IE8 and Chrome. IE8 shows syntax error in this file wp-e-commerce.js.

Ah yes, that is caused by some error output that is mucking up the AJAX call. The cart item Is appended just not letting the return happen correctly. I have tracked down a few places this happens and will be in 0.3.1 tonight.

Hi Greg
Thank you so much for getting this worked out.

I’m testing my local version of the plugin and I’m curious about the Domestic priority shipping rates. It seems to be terribly expensive for the values of the cart items I’m testing. USPS Domestic priority for 3 items is being calculated at $14.95 (within my own state – Colorado). I’m selling beads. Not very heavy and they don’t require a huge box. lol.

The weight for each item is 0.34 ounces. For a total of 1.02 ounces. The dimensions are 1.5 inches width, height, and length (each), for a total of no more than 4 square inches. Seems terribly expensive considering I would normally send these for the $4.95 Domestic priority rate. It appears that the shipping is being calculated per item (ie. 3 packages at $4.95 each), rather than a combined total.

Wondering if I just don’t have things configured properly?

For now I’ll use the first class mail option. Just don’t want to charge irrational amounts for priority shipping even though I would like to continue to offer the option to my customers.

Thanks again for your hard work. It is truly appreciated!

Thanks for the update Greg!

With 0.3.1 I saw the options for the various shipping options but again, when I go to update the product count I’m getting an error – slightly different

Fatal error: Cannot use object of type ASH as array in …/wp-content/plugins/advanced-shipping-plugin/includes/shipping.helper.php on line 542

I’m going to turn the plugin back off for now and I’ll send you info via your contact form. Thanks!

Hey Jonathan,
I’m having the same problem as you, with fatal error on line 542,
has Greg gotten back to you yet via private message as I’m hoping to find a solution, any info would be greatly appreciated!


I just tested this on my live site and it calculates Domestic priority perfectly. Must be my local server is totes whackt.. lol. Please disregard above comment of mine.

Thanks again Greg! You’re a life saver. 🙂

Greg, I just tried to upload the latest version of ash, 3.1 and got error 552 line.
I did not put in dimensions for each product. Is this necessary still?

I’m using the old ups 2.0 and it won’t calculate rates to India for me.

Please advise about this error and about dimensions?

Thanks again,


Dimensions are necessary for all international shipping or if you have checked off “Advanced Rates” in the admin panel for domestic rating.


For domestic rates it would calculate per-item if you checked “Advanced Rates” in the settings area. Glad to hear it is working for you though 🙂 . I am working on having it select the correct kind of package based on dimensions and some settings for a new release, maybe 0.3.(2 or 3).

Let me know if you run into issues though !

Hello everyone,
There is a new release tonight, v 0.3.1 this is a bug fix release that fixes many errors that have occurred dealing with array access etc. If you saw issues in the following scenarios, they should now be fixed.
1. Error activating, Header is invalid – added the Tested up to: 3.1 header info
2. Warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /home/team2win/public_html/wp-content/plugins/wpec_ash_0.3.0/modules/usps.php on line 808 – Should now be fixed
3. Error on line 557 of shipping.helper.php
4. When you are adding an item to your cart, there shouldnt be any errors now to stop the ajax from completing
I am still working hard on the more major changes including the issues with Priority shipping only using the small flat rate box and filtering the international rates better.

Downloaded the 0.3.1 and activated. Did settings. Am still getting error :
Fatal error: Cannot use object of type ASH as array in …wp-content/plugins/wpec_ash_0.3.0/includes/shipping.helper.php on line 557

I got a “Plugin could not be activated because it triggered a fatal error” message when attempting to activate the plug-in.

Parse error: syntax error, unexpected T_ARRAY, expecting ‘)’ in …wp-content/plugins/advanced-shipping-plugin/includes/shipping.helper.php on line 65

Any ideas on how I can fix this?

What version of PHP are you on ?
The simple way is just remove the “array” out of build_message(array $data) and see of that works.

Thanks for the heads up, I have someone that is giving me access to their install that is having this issue and I hope to have an answer / fix tonight!!

Fixed. Can’t see any info while on testing server.

OH BTW there is a misspelling in the settings section…. EACY

“This setting will provide rates based on the dimensions from eacy item in your cart”

The USPS test server is almost always broken. I honestly don’t know why I even left the check box there to begin with …

I agree the test server is useless. We had to go live to get any rates in. Otherwise it was blank. Anyhow, I am unable to hide the First Class option on the International array. It is not checked, but is showing up anyway.Checkout is here: U.K. zip code I was using: W2 4AD. First class is not appropriate for these products and client does not want to offer. Thank you so much for the fix. You are a hero. 🙂

Does this calculate based on weight? I have tested ordering multiple items and the shipping price doesn’t seem to change. If I order 100 products, that weight 2 pounds each, will it calculate a shipping cost based on 200lbs?


There seems to be something wrong with the USPS 2.0 shipping calculator plugin today.

Perhaps a change in USPS has caused the plug to not work correctly, as I am getting this error:

Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details. For more information, please contact us.

Can anyone explain how I can get shipping to acknowledge the zip codes on my check out page. I even see taxes being charged outside the state of Florida where I am located.

I like to know where I need to look so I can contribute to the cause.

Awesome update. It calculates domestic packages perfectly, after changing the container type for priority mail to variable. I am still having issues getting it to calculate international rates, its always 3 dollars less than rate gives.

Greg, I just tried to upload the latest version of ash, 3.1 and got error 552 line.
I did not put in dimensions for each product. Is this necessary still?

I’m using the old ups 2.0 and it won’t calculate rates to India for me.

Please advise about this error and about dimensions?

Thanks again,


I am still working on the following error, it is taking quite some time to find a root cause. However I know that it is fixed if you can upgrade your PHP version to 5.3 or above it should work. This seems to be only happening on 5.2 versions as far as I can tell. Please let me know if it is happening on other versions!

Fatal error: Cannot use object of type ASH as array in …wp-content/plugins/wpec_ash_0.3.0/includes/shipping.helper.php on line 557

Well, I have WP-Ecommerce, I am using the “Elegance” Theme by Storefront, I have purchased the Gold Cart and just installed the USPS 2.0 plugin because the old one kept giving me the “Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details” error.

Since installing the new USPS 2.0 plugin I am still getting the same error. I’ve put in approx dimensions & weight (I sell dresses and jewelry), and checked all services from USPS. I don’t know what else to do. I’d rather not use the UPS or FEDEX options as I am a new business owner and am trying to test out my options first.

Can somebody PLEASE help me figure this all out? I’ve spent months customizing and developing my website which is BEAUTIFUL and I really don’t want to have to switch platforms yet again ( I love WordPress!)

Thanks in advance!!

We just updated to 3.8.1 and had to change a pile of stuff to get it all to fit with our theme again. Now it appears we can’t get USPS to work anymore either. We get the same “Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details” For now USPS is off and only UPS and weight rate is on. Arg.

Hey – we’re getting an odd issue where people select “Priority Mail” as their option, but end up being charges a UPS rate. Any ideas what might cause this? We’ve had it happen 10-12 times now.


As far as product dimensions, should I be thinking about the dimensions of each item individually, like a book or a blender? Or should I be measuring the package I’d send the book in? Books can be shipped in envelopes too. Multiple books could also end up in a box. The packaging could vary quite a bit here.

Well, things were working great.

But it appears that the plugin has stopped calculating rates now and/or showing them on the checkout page.
Don’t know if it’s an error with or some customization I might have done to the checkout page. Either way – it’s not working now 🙁

Also, I’m hunting and hunting and trying to find some way to add taxes to shipping costs. Apparently Texas likes to get taxes on your shipping costs as well as your actual sell.

Can’t help with your other issues but I found a workaround for taxes on shipping that works for me. Instead of using wp-ecommerce’s tax, I configure it in Paypal and then the tax is calculated on the payment page for the total.

Fatal error: Cannot redeclare class ASHXML in /home/emperor/public_html/ on line 3

This is what i got when activating the new plugin that would “fix” all my problems 🙂
Please help.

I tried installing Advanced Shipping 0.3.1… also saw fatal error message when attempting to calculate US domestic shipping rates based on weights of variants of products. For example, 1 pound bag, 2 pound bag, etc.

What’s the timetable exactly for the release of WP e-commerce 3.8 or the next version of Advance Shipping 0.3.2?

I’m running WP e-commerce 3.7.8.

Fatal error: Cannot use object of type ASH as array in …/public_html/wp-content/plugins/advanced-shipping-plugin/includes/shipping.helper.php on line 542

Looking at the code… I think there’s a variable naming problem. The problem is described here:

Specifically, the error is referring to the following line:

shipping.helper.php line 542: $_SESSION[“wpec_ash”][$internal_name][“rate_table”] = $rate_table;

(so $_SESSION[“wpec_ash”] in this context is not an array — it is of type ASH — for some reason)

Perhaps the following line was not run, or (more likely in my opinion) the global variable $wpec_ash is the same as $_SESSION[“wpec_ash”].

shipping.helper.php line 422: in set_destination(): $_SESSION[“wpec_ash”] = array();

The following lines in wpec_ash.php set $wpec_ash to the type ASH which is consistent with the error message.
Line 19: global $wpec_ash;
Line 20: $wpec_ash = new ASH();

So, one possible fix might be to change the names so they don’t collide.

My configuration is:
WordPress 3.1
Weaver Theme 2.0,
WP e-Commerce 3.7.8
Advanced Shipping 0.3.1
Hosting: HostGator default php.ini settings (register_globals = ON)

Hope this helps in troubleshooting.

have resolved this issue using WP E-Commerce 3.8 and not using Advanced Shipping (deleted the plugin after re-declaration of classes error).

what i did was to change $_SESSION[“wpec_ash”] in shipping.helper.php to a new name $_SESSION[“wpec_ash_name”] (or any new name you want)

hope that helps

Hi Perry: where do I need to make those changes ? I changed that in all the entries for wp-e-commerce/wpsc-includes/shipping.helper.php and get the error below

Warning: unserialize() expects parameter 1 to be string, object given in /home/qbjjtmxw/public_html/samplesites/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 276

Fatal error: ash_ups::ash_ups() [ash-ups.ash-ups]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "ASH" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/qbjjtmxw/public_html/samplesites/wp-content/plugins/wp-e-commerce/wpsc-shipping/ups_20.php on line 23

I already remove ASH from my plugin list. Also bought Gold Cart thinking that will help but haven’t been able to get it to work. I can’t find where to enter API key or do anything.

Hi vinnie,
This plugin is no longer required. The UPS and USPS files are included in the 3.8 version of WP e-Commerce already.


I need a download link, USPS working but my international rates are not really synced with USPS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.