Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    18
    Plugin Contributions
    0

    Default Items less then 1 ounce for USPS shipping

    I see this code:

    // usps doesnt accept zero weight

    $usps_shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight);

    $shipping_pounds = floor ($usps_shipping_weight);

    $shipping_ounces = round(16 * ($usps_shipping_weight - floor($usps_shipping_weight)));
    If I wanted to make the ounces round up to the 10th of an ounce or less would I just change the 16 to or would I change the shipping weight to read < 1 ? 1 :

    I have seriously tried to change the code to < 1 ? 1 : and it then says that for USPS to ship first class mail it has to weigh under 13 ounces. All of my inventory weighs under an ounce. Most of it weighs 0.000568091 and .0625. How do I get the shipping correct? (I only need first class shipping.)
    Last edited by wicks; 11 Apr 2009 at 03:00 AM.

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Items less then 1 ounce for USPS shipping

    the shipping weight is in pounds - so your <1 ? 1: edit results in anything less than 1 pound being set to 1 pound. The original $usps_shipping_weight line makes anything less than 0.1 pounds equal to 0.1 pounds - that is then converted to ounces in the $shipping_ounces line, which would make your absolute minimum weight for submission to USPS equal 1.6 ounces.
    You could change all that code to this to ensure that the minimum weight submitted is 1 ounce.

    Edit: oops - clicked the wrong button and submitted before I finished...will post suggested code in a few minutes....
    Last edited by bunyip; 11 Apr 2009 at 06:11 AM.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Items less then 1 ounce for USPS shipping

    You could change all that code to this to ensure that the minimum weight submitted is 1 ounce, and ounces are submitted to one decimal place (which the USPS API accepts):
    PHP Code:
      $shipping_pounds floor ($shipping_weight);
      
    $shipping_ounces number_format(16 * ($shipping_weight floor(shipping_weight )), 1);
      if (
    $shipping_pounds == and $shipping_ounces 1$shipping_ounces 1
    Neville
    An assumption is what you arrive at when you get tired of thinking...

 

 

Similar Threads

  1. Replies: 4
    Last Post: 30 Jul 2011, 06:11 AM
  2. Shipping for items less than a pound...How do I???
    By wncds in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 31 Aug 2010, 06:40 PM
  3. Free Shipping for $299 or more and for less then 100 miles away ...
    By adjinwis in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 4 Sep 2009, 01:42 PM
  4. USPS Shipping charge calculation, many items = less accuracy
    By Olof Holte in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 11 Mar 2009, 09:29 PM
  5. Same shipping cost for up to X items, then increment shipping after that
    By infinitecreature in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 4 Dec 2008, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg