How to Make Shipping Apply for Each Individual Item in WooCommerce (Beginner’s Guide)
Are you tired of WooCommerce combining shipping costs for all the items in a customer’s cart, even if they’re bulky or need to be shipped separately? You’re not alone! Many store owners need to charge shipping per item rather than per order, especially if they sell:
- Large or awkwardly shaped items: Think furniture, artwork, or custom-built parts.
- Items requiring specialized packaging: Fragile goods, electronics, or hazardous materials might need their own protective container.
- Items shipping from different locations: If you dropship or use multiple warehouses, each item’s shipping originates separately.
- Per Item Shipping: `[qty]*10` (Replace `$10` with your desired shipping cost per item).
- No shipping class cost: 0 (Important: Sets default to 0 for other products).
This guide will show you how to achieve item-based shipping in WooCommerce, ensuring your customers pay a fair price and you avoid eating shipping costs. We’ll break down a simple method using WooCommerce’s built-in features and some clever workarounds.
Why Per-Item Shipping Matters
Let’s illustrate with a real-life example. Imagine you sell handmade wooden toys.
* Scenario 1 (Default WooCommerce): A customer buys a small wooden car (shipping cost: $5) and a large rocking horse (shipping cost: $20). WooCommerce might combine these and only charge, say, $20, leaving you short $5 on the actual shipping.
* Scenario 2 (Per-Item Shipping): The customer buys the same car and rocking horse. WooCommerce correctly charges $5 for the car and $20 for the horse, totaling $25. You cover your costs and remain profitable.
Charging per item is about fairness and accuracy. It prevents you from undercharging on complex orders and potentially losing money. It also gives your customers a clearer understanding of the actual shipping expenses.
Method 1: Utilizing WooCommerce’s Weight-Based Shipping with a Clever Trick
While WooCommerce doesn’t have a direct “per-item shipping” option, we can leverage weight-based shipping with a few tweaks. This is the most common and easiest way to achieve a similar result.
Step 1: Set up Weight for Each Product
The core of this method lies in accurately setting the weight of each product. This weight will represent a shipping unit.
1. Go to Products > All Products in your WooCommerce dashboard.
2. Edit the product you want to configure.
3. In the Product Data meta box, go to the Shipping tab.
4. Enter a weight for the product. This is crucial! If you want each item to be treated separately, the actual numerical value is less important; the *presence* of a weight and the shipping class (below) is more important. You can use a consistent “dummy weight” (e.g., 1 lb or 1 kg) for all such items.
5. Click Update to save the product.
 <- Replace with actual image later
Step 2: Create a Shipping Class for Per-Item Shipping
Shipping classes allow you to group products and apply specific shipping rules to them.
1. Go to WooCommerce > Settings > Shipping > Shipping Classes.
2. Click Add shipping class.
3. Enter a Shipping class name (e.g., “Per Item Shipping”).
4. Enter a Slug (optional; can be the same as the name).
5. Enter a Description (optional).
6. Click Save shipping classes.
 <- Replace with actual image later
Step 3: Assign the Shipping Class to Your Products
Now, connect your products to the “Per Item Shipping” class.
1. Go back to Products > All Products.
2. Edit the product you configured in Step 1.
3. In the Product Data meta box, go to the Shipping tab.
4. Select the “Per Item Shipping” class from the Shipping class dropdown.
5. Click Update.
 <- Replace with actual image later
Step 4: Configure the Flat Rate Shipping Method with Shipping Class Costs
This is where the magic happens. We’ll use flat rate shipping and apply a specific cost *per shipping class instance*.
1. Go to WooCommerce > Settings > Shipping > Shipping Zones.
2. Select the shipping zone you want to configure (or create a new one).
3. Click Add shipping method and choose Flat rate.
4. Click Edit next to the “Flat rate” shipping method.
5. In the Cost field, enter `[qty]` and `[qty]*10` to charge $10 per quantity of item.
6. Under Shipping class costs, enter the following:
7. Click Save changes.
 <- Replace with actual image later
Explanation:
* `[qty]` is a WooCommerce shortcode that represents the quantity of items in the cart with that shipping class.
* By setting the cost *per shipping class*, you ensure that each product assigned to “Per Item Shipping” will add `$10` (or your chosen amount) to the shipping cost.
* The “No shipping class cost” is crucial to prevent double-charging. If a product *doesn’t* have the “Per Item Shipping” class, it won’t incur any extra shipping cost from this rule.
Example:
Let’s say a customer buys two items with the “Per Item Shipping” class. The shipping cost will be: `2 * $10 = $20`. If they also buy an item *without* that class, its shipping will default to $0 (or whatever other shipping rules you have set up).
Method 2: Code Snippet (More Advanced – Proceed with Caution!)
Warning: Modifying your theme’s `functions.php` file or using code snippets can break your site if done incorrectly. Back up your site before proceeding, or consider hiring a developer.
This method uses a PHP snippet to calculate shipping costs dynamically based on individual item weights. It’s more flexible but also requires more technical knowledge.
<?php /**
// Calculate the shipping cost for this item.
// Example: $5 per kg/lb
$item_shipping_cost = $product_weight * 5; // Adjust this value as needed
// Add the item’s shipping cost to the total.
$total_shipping_cost += $item_shipping_cost * $item[‘quantity’];
}
// Update the package cost.
$packages[ $package_key ][‘rates’][‘flat_rate:10’][‘cost’] = $total_shipping_cost;
// Optional: Update the package label (e.g., add the total shipping cost to the label)
$packages[ $package_key ][‘rates’][‘flat_rate:10’][‘label’] = ‘Flat Rate Shipping (Weight-Based): ‘ . wc_price( $total_shipping_cost );
}
return $packages;
}
add_filter( ‘woocommerce_package_rates’, ‘custom_calculate_shipping_per_item’, 10, 1 );
?>
How to Use:
1. Backup your website!
2. Add this code snippet to your theme’s `functions.php` file or use a plugin like “Code Snippets”.
3. Modify the `$item_shipping_cost` calculation: This is the most important part. Adjust the `* 5` to reflect your desired shipping cost per unit of weight. For example, if you want to charge $10 per pound (or kg), use `* 10`.
4. Adjust the ‘flat_rate:10’ values: The `flat_rate:10` represents your flat rate shipping method id, you can get this by inspecting the shipping methods on the cart page of your store.
5. Test thoroughly!
Explanation:
* This code iterates through each item in the customer’s cart.
* It retrieves the weight of each product using `$item[‘data’]->get_weight()`.
* It calculates the shipping cost based on the weight and a defined rate (in our example, $5 per unit of weight).
* It adds the calculated shipping cost to the total shipping cost for the order.
* Finally, it updates the shipping cost in WooCommerce.
Choosing the Right Method
* Method 1 (Weight-Based with Shipping Classes): Best for beginners. Simple to set up and manage, especially if you have a relatively consistent shipping rate per item.
* Method 2 (Code Snippet): Offers more flexibility but requires coding knowledge. Suitable for stores with complex shipping rules or if you need very precise weight-based calculations.
Testing Your Shipping Setup
Crucially, test your chosen method thoroughly!
1. Add different combinations of products to your cart.
2. Go through the checkout process.
3. Verify that the shipping costs are calculated correctly.
Conclusion
Implementing per-item shipping in WooCommerce can significantly improve the accuracy of your shipping costs and enhance customer satisfaction. By using the methods outlined in this guide, you can tailor your shipping strategy to the specific needs of your products and business. Remember to always test your setup thoroughly before going live to avoid any unexpected shipping discrepancies!