Title: Getting wrong USPS rates.
Last modified: April 3, 2018

---

# Getting wrong USPS rates.

 *  Resolved [damogo](https://wordpress.org/support/users/damogo/)
 * (@damogo)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/)
 * I am trying to calculate a box to Switzerland and other countries and I always
   get the wrong rates, always between US$6 to US$8 of difference, the test that
   I did with Switzerland I did it enabling the debug mode and I got this:
 * Received rate: Priority Mail International ($64.30) 14x10x6
    Received rate: Priority
   Mail Express International ($86.65)14x10x6
 * Then I went to USPS Calculator and I got this with the same box in inches (14x10x6):
 * Priority Mail International® $55.45
    Priority Mail Express International™ $74.50
   And I also get a First Class option of $51.50 that the plugin is not showing 
   and I have the “First Class International Shipping” enabled under “Others” under
   the USPS Options for this country.
 * As an additional tip when the package is small, the rates I get are often the
   same as the ones on USPS Calculator.
 * What am I doing wrong?
    -  This topic was modified 8 years, 1 month ago by [damogo](https://wordpress.org/support/users/damogo/).
    -  This topic was modified 8 years, 1 month ago by [damogo](https://wordpress.org/support/users/damogo/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Contributor [Jeff Stieler](https://wordpress.org/support/users/jeffstieler/)
 * (@jeffstieler)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10154583)
 * Hello [@damogo](https://wordpress.org/support/users/damogo/),
 * Can you share some more information about your shipping configuration and product?
   What is your origin zip code? How much does the product weigh?
 * Using a 3lb product with the same dimensions (14x10x6), shipping from 90210, 
   the cart rates match the USPS postage calculator. See the screenshot below:
 * ![](https://i0.wp.com/cldup.com/Dh9LzOLUHm-3000x3000.png?resize=3000%2C3000&ssl
   =1)
 *  Thread Starter [damogo](https://wordpress.org/support/users/damogo/)
 * (@damogo)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10155141)
 * Hello [@jeffstieler](https://wordpress.org/support/users/jeffstieler/), thank
   you very much for answering.
 * I am shipping from 67211, I was able to fix the costs by adjusting the weights
   of the boxes and now I am getting the right rates, but since I am trying to ship
   bottles (vitamins and supplements) I noticed by activating the debug mode that
   I am getting some odd box selections when trying to calculate shipping, for example
   I have a bottle which measurements are 5″x5″x6.9″ (LxWxH) and I am selecting 
   4 of them for testing purposes and the debug tells me that the box I should be
   using is a 14x10x6 (Which makes me think that the program is laying them down
   on the box and this is not optimal for bottles) when those products can fit perfectly
   in a 12x12x8 standing up (in a vertical way).
 * This also happened when I was trying to process an order over the phone, the 
   debug mode showed the box 12x12x12 to calculate the shipping costs, when everything
   would fit on a 12x12x8. I double checked the sizes and weights on the bottles
   and everything seems to be ok, but the box selection so far has been really odd.
 * Is there any way to control that?
 *  Plugin Contributor [Jeff Stieler](https://wordpress.org/support/users/jeffstieler/)
 * (@jeffstieler)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10155259)
 * > I was able to fix the costs by adjusting the weights of the boxes and now I
   > am getting the right rates
 * Great!
 * > I have a bottle which measurements are 5″x5″x6.9″ (LxWxH) and I am selecting
   > 4 of them for testing purposes and the debug tells me that the box I should
   > be using is a 14x10x6 (Which makes me think that the program is laying them
   > down on the box and this is not optimal for bottles) when those products can
   > fit perfectly in a 12x12x8 standing up (in a vertical way).
 * Your thinking is correct – the box packer has selected the 14x10x6 box, which
   would require laying the bottles down. We understand that’s a bad idea, but the
   box packer has no idea it was handed irregularly shaped fragile items. 🙂
 * The reason it chose the 14x10x6 box over the 12x12x8 is that it’s the most efficient
   use of space – it has the least amount of unused volume.
 * Since this packing result is unacceptable in your case, and we have no way to
   force a packing orientation, may I suggest changing the product (bottle) height
   to be more than 7″ – perhaps 5″x5″x7.1″. This should force the 12x12x8 box to
   be used, since the bottles will no longer fit laying down in the 14x10x6 box.
 * IMPORTANT: Please make sure to test several different packing scenarios involving
   this bottle product before considering this an acceptable fix!
 *  Thread Starter [damogo](https://wordpress.org/support/users/damogo/)
 * (@damogo)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10161476)
 * Hi [@jeffstieler](https://wordpress.org/support/users/jeffstieler/),
 * I will do those tests, they sound like they may work, now I have a second question,
   I was able to modify the code to pull the total weight of my cart and display
   it on the car totals, but I have issues trying to find the function that pulls
   the box sizes like the debug mode does, is there a way I can do that without 
   activating the debug mode? this is for quote purposes.
 * This is the code I used to pull the total weights:
 *     ```
       <td class="product-weight">
          <?php
            echo '<p class="total-weight">' . __('Total Weight: ', 'woocommerce');
            echo apply_filters( 'woocommerce_cart_item_weight', WC()->cart->cart_contents_weight);
            echo get_option('woocommerce_weight_unit');
          ?>
        </td><!-- /.product-weight -->
       ```
   
    -  This reply was modified 8 years, 1 month ago by [damogo](https://wordpress.org/support/users/damogo/).
    -  This reply was modified 8 years, 1 month ago by [damogo](https://wordpress.org/support/users/damogo/).
    -  This reply was modified 8 years, 1 month ago by [damogo](https://wordpress.org/support/users/damogo/).
 *  Plugin Contributor [Jeff Stieler](https://wordpress.org/support/users/jeffstieler/)
 * (@jeffstieler)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10162008)
 * Hello [@damogo](https://wordpress.org/support/users/damogo/),
 * I think I can point you in the right direction, but please understand that we
   don’t provide support for code customizations.
 * That said, take a look at `WC()->shipping->get_packages()`. Here’s an example
   of it being used in WooCommerce core: [https://github.com/woocommerce/woocommerce/blob/64bcabf0af9a05274d53ec833a4e8c9153509bc4/includes/wc-cart-functions.php#L206](https://github.com/woocommerce/woocommerce/blob/64bcabf0af9a05274d53ec833a4e8c9153509bc4/includes/wc-cart-functions.php#L206)
 *  Thread Starter [damogo](https://wordpress.org/support/users/damogo/)
 * (@damogo)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10162873)
 * Thanks for the suggestion [@jeffstieler](https://wordpress.org/support/users/jeffstieler/),
 * As most of the people writing to you with issues I am a newbie in this, this 
   is what I got so far with no luck:
 *     ```
       <?php
       $packages = WC()->shipping->get_packages();
       echo $packages[wc_connect_packages]->box_id;	
       ?>
       ```
   
 * I know you do not support for code customizations but I really need a hand hahaha
    -  This reply was modified 8 years, 1 month ago by [damogo](https://wordpress.org/support/users/damogo/).

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Getting wrong USPS rates.’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-services/assets/icon-256x256.png?rev=3234419)
 * [WooCommerce Tax (formerly WooCommerce Shipping & Tax)](https://wordpress.org/plugins/woocommerce-services/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-services/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-services/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-services/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-services/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-services/reviews/)

## Tags

 * [calculation](https://wordpress.org/support/topic-tag/calculation/)
 * [rates](https://wordpress.org/support/topic-tag/rates/)
 * [usps](https://wordpress.org/support/topic-tag/usps/)
 * [wrong](https://wordpress.org/support/topic-tag/wrong/)

 * 6 replies
 * 2 participants
 * Last reply from: [damogo](https://wordpress.org/support/users/damogo/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/getting-wrong-usps-rates/#post-10162873)
 * Status: resolved