How to make First Class Int'l Large Envelope appear?
-
My question deals with the WooThemes USPS shipping plugin.
The plugin shows these options for First Class Int’l:
First Class Mail? International Letters
First Class Mail? International Large Envelope
First Class Package International Service?If I have a product in the cart that is 8.5x11x.25 inches in size, 9oz weight (a thin book), then First Class International Large Envelope SHOULD come up as an option in the shipping calculator, however, it’s not. Can someone tell me why? It’s only displaying the more expensive Package option.
The shopping cart I’m currently using does display the Large Envelope option with its USPS shipping module, so I know it functions as a viable option from the USPS servers.
Thanks for your help!
-
Hey @mdc2957,
I entered a product in to test, I used your dimensions, but I made the length the largest side, so 11×8.5x.25, and this is what I received shipping from Florida to Uganda:
First Class Mail? International: $15.25
International Priority Mail Flat Rate?: $29.15
International Priority Mail Express Flat Rate?: $51.15
Global Express Guaranteed? (GXG) (1 – 3 business days): $122.29Does this seem right to you? If so, make your largest dimension your length. This is not mentioned in the documentation, but it is a standard in shipping.
I checked my product and yes, I did enter it the same way you did, length being the longest side. The issue is that it’s not pulling up First Class International Large Envelope. The one you’re seeing, First Class Mail? International: $15.25, is the Package rate. There’s a difference. Large Envelope is a lesser rate than Package, kind of frustrating it doesn’t come up. I actually show $15.40 for the Package rate on the USPS site:
But yeah, something I think is wrong with the woothemes plugin
I’m not sure, because I turned on debugging and USPS isn’t even returning a quote for a large envelope.
When using the USPS Price Calculator, I am not able to purchase the postage for the Large Envelope online like the rest of the items > screen shot. It almost seems like they only do this method in the physical location. Maybe try contacting USPS tomorrow? That’s what I would do.
It’s not a USPS issue. WooThemes lists Large Envelope as an option in the settings so it should be returning a rate for it. Is there any way to not use the box packer thing and just have weight determine the rates that come up?
The way the USPS API works is you submit your package information and it returns all rates, the WooCommerce USPS plugin then filters those results according to your choices.
There is a sample International API request on the USPS API page, and I’ve copied and pasted it below. I added in the proper weight and dimensions, set the size to regular, the value to 10, and set the userid to the one that is in the plugin by default. If you copy and past all of the text, put it in your browser address bar and hit enter, you should receive the same response the plugin does. If you then search for envelope, you can see there’s no response for a large envelope.
https://production.shippingapis.com/ShippingApi.dll?API=IntlRateV2&XML=<IntlRateV2Request USERID="150WOOTH2143"> <Revision>2</Revision> <Package ID="0"> <Pounds>0</Pounds> <Ounces>9</Ounces> <Machinable>True</Machinable> <MailType>package</MailType> <ValueOfContents>10</ValueOfContents> <Country>United Arab Emirates</Country> <Container>rectangular</Container> <Size>regular</Size> <Width>8.5</Width> <Length>11</Length> <Height>.25</Height> <Girth>0</Girth> <OriginZip>22201</OriginZip> <CommercialFlag>Y</CommercialFlag> <ExtraServices> <ExtraService>1</ExtraService> </ExtraServices> </Package> </IntlRateV2Request>
Thank you, that is helpful, I think I know why it’s not returning the Large Envelope option. It’s showing the type as package: <MailType>package</MailType>
In my other shopping cart, it asks for international mail type in the settings, where I can specify Large Envelope, see screenshot:
https://oi66.tinypic.com/2qa23p0.jpg
So apparently, the woothemes plugin automatically specifies Package instead which is what causes the Package service to come up instead of Large Envelope. That’s a bummer!
I just discovered something that might be useful:
https://docs.woothemes.com/document/usps-shipping/
Go down to the section that says Filtering Flat Rate Services near the bottom. This looks like it might be fixable, but this code snippet seems to only apply for flat rate options so I’m not quite sure as I’m not a code person…
I probably should have asked this sooner, but have you created a custom box for this item? If so, you can mark it as a letter and it should return the letter options. I feel silly for letting it slip my mind.
I tested and found a problem with this method, though. There is a bug in the code…
This line looks for the “is_letter” checkbox that you check when creating a box:
$request .= ' <MailType>' . ( empty( $this->boxes[ $box_package->id ]['is_letter'] ) ? 'PACKAGE' : 'ENVELOPE' ) . '</MailType>' . "\n";
If the checkbox is checked, then it should mark the package as an envelope, however…
This is the
boxes
array it’s looking in:$this->boxes: Array ( [0] => Array ( [name] => large envelope [outer_length] => 11 [outer_width] => 8.5 [outer_height] => 0.25 [inner_length] => 11 [inner_width] => 8.5 [inner_height] => 0.25 [box_weight] => 0.01 [max_weight] => 1 [is_letter] => 1 ) )
and this is the box that I created:
$box_package: stdClass Object ( [id] => large envelope [packed] => Array ( [0] => WC_Boxpack_Item Object ( [weight] => 0.56249887221 [height] => .2 [width] => 8.4 [length] => 10.9 [volume] => 18.312 [value] => 2 [meta] => Array ( ) ) ) [unpacked] => Array ( ) [weight] => 0.57249887221 [volume] => 18.312 [length] => 11 [width] => 8.5 [height] => 0.25 [value] => 2 [percent] => 100 )
Since it’s looking for the
id
in the array, it is never found. Theid
islarge envelope
and the array keys are numeric, so it will never be found, and the package will never be specified as an envelope.I’ll still look to see if I can create an work around for this.
Seems like a mess. I did try the box packer thing too. Actually I don’t want to use that. I really just want my orders to be based on weight. According to USPS anything 4 lbs and less goes First Class International. I really don’t want the plugin determining package sizes and all that so I want to use the third option under Parcel packing that says “Weight based”
If there’s a way to make it show First Class Int’l Large Envelope, using the weight based method only, then I’ll be happy.
It’s technically possible, but it would require someone to modify the plugin to your needs. The problem with that is that any future updates would then remove the changes put in place.
The best solution would be to use the box packer with a custom box, however, that appears to be broken at the moment.
Even if it worked, I couldn’t use the box packer because I routinely fill envelopes more than the maximum thickness limit and the USPS never kicked one back. I use #4 or #5, or sometimes even #7 jiffy envelopes and pack them pretty full so they’re more than .75 inches thick.
I may have found the problem, but I’m not a code person so I’m not sure if this is right, take a look at this file:
\woocommerce-shipping-usps\includes\class-wc-shipping-usps.php
On a few different lines, this appears:
<MailType>Package</MailType>
The rate calculator API documentation: https://www.usps.com/business/web-tools-apis/rate-calculator-api.htm#_Toc423593297 shows the following as options for MailType.
enumeration=All
enumeration=Package
enumeration=Postcards
enumeration=Envelope
enumeration=Letter
enumeration=LargeEnvelope
enumeration=FlatRate
enumeration=FlatRateBoxPackage is hard coded in the WooThemes plugin according to what I’m seeing in that file, and I THINK this is the reason the package rate, instead of the large envelope is being returned. However, I’m not certain how to fix it. I’d actually like to offer both package and large envelope services to my customers because tracking is available to several countries with the package service.
Yes, that is part of the problem, but it is more complicated than that due to how difficult it can be to automatically pack boxes and/or envelopes.
The plugin will not know the size of the envelope/package you are trying to use unless you specify it, then tell the plugin to use that envelope. Even then, it would only be able to fill the inner dimensions you specify, then it would submit the outer dimensions to USPS for a rate quote.
So, if someone bought 4 items, and the dimensions were set so that only 3 could fit in an envelope, it would then get a quote for 3 items in one envelope and 1 item in another envelope. This is even though you know you physically can fit 4 items in one envelope.
If you are wanting to do the items by weight, the plugin does not currently have the logic to see if the items being shipped fit within the constraints of envelope sizes for international packages, it only appears to do this for domestic packages.
After reviewing the code ( a lot ), it seems that the plugin itself is lacking for international shipping and is more focused on domestic shipping.
I submitted a ticket a week ago about the box packer not properly including user defined letters/envelopes, but WooThemes support is currently behind so the ticket has not been reviewed yet. Until it is fixed, I still believe your best method would be to create your own box/package and have the items be quoted as a package.
Under Parcel Packing Method, just choose “weight based” and I think that ignores the box packer entirely. It says items less than 12 inches are grouped and quoted by weight only. That’s fine, that’s what I want. By changing the mailtype to LargeEnvelope, I think it’s working now, returning the rates for that service, but I want to have both (some people might want to pay a little extra for the tracking that the Package service does offer) But right now it seems I can only have one or the other, LargeEnvelope or Package, but not both. The plugin configuration under Services, leads you to believe that you can choose to display all 3:
First Class Mail? International Letters
First Class Mail? International Large Envelope
First Class Package International Service?by checking the coinciding boxes, but as we’ve seen, only Package rate returns because that’s what the mailtype is set to in the php file. If I could have it display both to the customers, based on weight only, I’d be a happy camper.
Unfortunately it only chooses the cheapest method for these services
'I_FIRST_CLASS' => array( // Name of the service shown to the user 'name' => "First Class Mail® International", // Services which costs are merged if returned (cheapest is used). This gives us the best possible rate. 'services' => array( "13" => "First Class Mail® International Letters", "14" => "First Class Mail® International Large Envelope", "15" => "First Class Package International Service™" ) ),
- The topic ‘How to make First Class Int'l Large Envelope appear?’ is closed to new replies.