What can we help you with?

Woocommerce Stamps.com Plugin – Pack into Specific Flat Rate Box Based on Quantity

This is a business case from a customer using ELEX Stamps.com Shipping Plugin with USPS Postage for WooCommerce. In his shop, he has products of similar dimensions and wants to pack them in the flat rate boxes based on the number of items added to cart. For example if the number of item in cart is 1-2, pack them in the Small Flat Rate Box. If the number of item in cart is 3-9, pack them into the Medium Flat Rate Box, and if the number of item in cart is 10-21, pack them in the Large Flat Rate Box. And, if more than 21 items, then pack in a custom box defined in the packing options. Right now the issue is that the shipping cost is not showing correctly for the number of items since it’s not exactly packing the way he wanted.

If we can get the correct packing option for the number of items, the shipping cost will automatically show correctly. In this article, I’ll explain what are the packing options available in the Stamps.com plugin and which packing option you need to use to achieve this. There are couple of methods we can use to achieve this. Based on which is relevant to your business case you can use either of these methods.

Install And Configure The Stamps Plugin

To achieve this, you need our  ELEX Stamps.com Shipping Plugin with USPS Postage for WooCommerce. To set up the plugin you have to Register with Stamps.com and create an account. Use the Stamps.com login credentials in the plugin settings under the username and password field, and choose the API mode ‘Live’. Enable the Services in the plugin settings, under the ‘Rates and services’ tab. Under the Priority mail services enable the Small Flat Rate Box, Medium Flat Rate Box, Large Flat Rate Box and Package services as shown below. The package service is required for the custom packing option. You need to add the “Ship from address” in the plugin settings and also add weight and dimensions to all the products including the simple and variations. To add weight and dimension to the products you can go to Edit products, and under the shipping tab (in product data settings) you get the option to add weight and dimension to the products. If you’re enabling international shipping, then you need to add the country of manufacture and also the HS Tariff code. The country of manufacture should be two-character country code for United states. Enter the country code as US, and regarding the HS Tariff code, you can check the correct HS codes in the following link: http://www.cybex.in/HS-Codes/Unused-Postage-Revenue-Similar-Stamps-Hs-Codes-49070010.aspx To add weight and dimension to the variations, you can expand the variation and you’ll have the option to add weight and dimension. Once the set up is done add a product to cart and check if you’re getting the shipping options from Stamps.com.

The plugin has three different packing option-

  1. Individual packing,
  2. Weight based packing and
  3. Recommended pack into boxes with weight and dimension.


How To Make This Work?

For this business case, we’ll need to use the 3rd packing option “Recommended pack into boxes with weight and dimension”. Go to the packing options in the plugin settings and choose the packing option “Recommended pack into boxes with weight and dimensions”. Enable the Flat Rate boxes which are predefined. So, according to the above business case you’ll have to enable the Small Flat Rate Box, Medium Flat Rate Box, Large Flat Rate Box,

To add the custom box, go to the bottom of the page and you’ll have the option to add a custom box. Click on the “Add box” button and enter the outer and inner dimension of the box and the max weight that you want to pack into this box.
Also, you need to choose the packing algorithm as “Stack first Algorithm”. 

Now the first option to make this work is by giving the dimension of the products such that only 1-2 items fit into the Small Flat Rate Box. 3-9 items fit in the Medium Flat Rate Box, 10-15 items fit in the Large Flat Rate Box. And if more than 15 items then pack in a custom box. The Flat Rate Box sizes are: Small box: 5.375 x 8.625 x 1.625″; Medium: 13.625 x  11.875 x 3.375″ and Large: 12 x 12 x 5.5″.

For the Small Flat Rate Box, to accommodate two items, the product dimensions could be 5.3 x 8..625 x 0.8. Two of these dimensions can fit into the small box easily, and up to 9 can fit into the medium box (Top Loading), and 21 can fit into the large box. And if there’s more items in the cart, it will choose the custom box (if the dimensions are big enough). If not, the plugin will choose another flat rate box to pack the items as a second package. This solution is good enough if you can set the dimension of the products correctly, but if its not possible to get the correct dimension you’ll have to edit the plugin code to customize the Flat Rate Box sizes or Weight.

In the second option, which is less complicated, you can edit the plugin code and customize the weight and dimensions of the Flat Rate Boxes so that the plugin will pack according to the cart total weight. Go to the plugin Editor and select usps-stamps-woocommerce-shipping>includes>data-wf-box-sizes.php. Here you’ll find the box sizes and max weight. Change only the max weight of the box that Flat Rate Box should handle. So if the product weight is 0.5 lbs, you can give the max weight for the small flat rate box as 1 lbs. And max weight for the Medium Flat Rate Box as 8.5 lbs And Max weight for the Large Flat Rate Box as 10.5 lbs. You can change the max weight of the boxes according to your requirement. So when the items are added to the cart, depending on the total cart weight, the plugin will pack into the boxes. This solution should work with different combination of max weight so it could be a better solution than giving the specific dimension to the products, but the changes made in the plugin code will disappear every time you update the plugin.

The below screenshot shows where you can change the max weight of the flat rate box – example for the small flat rate box.
Once these configurations are done you’ll get the correct shipping rates according to the number of items added to cart.

See below Images; Cart with 1-2 items you get Small Flat Rate Box prices.

Cart with 3-9 items, you get Medium Flat Rate Box prices.

Cart with 10-21 items, you get Large Flat Rate Box prices.
Hope this article has helped you with your business case. if you have a requirement with different number of items and the flat rate box price linked to it you can always change the max weight of the flat rate boxes according to the total weight of the items you want to pack into it. For any clarifications, please contact our support team.


To explore more details about the shipping plugins, please check out the product pages.

You can also check out other WooCommerce and WordPress plugins in ELEX.

Previous How to Customize USPS Shipping Labels using ELEX WooCommerce Stamps.com Shipping Plugin with USPS Postage? (with Video)
Next How to Use the Stamps.com USPS Shipping Plugin for WooCommmerce in Test Mode?
You must be logged in to post a comment.