WooCommerce: How to Offer Free Shipping on a Single Product
Introduction:
Offering free shipping is a powerful way to entice customers and boost sales in your WooCommerce store. However, blanket free shipping on *every* item might not always be financially viable. Sometimes, you want to offer free shipping as a special promotion on a specific product, perhaps to clear out inventory, reward loyal customers, or drive traffic to a new release. This article guides you through the process of setting up free shipping for a single item in WooCommerce. We’ll cover the most common methods, their pros and cons, and help you choose the best approach for your needs. This will allow you to tailor your shipping strategy and maximize your profitability.
Main Part: Configuring Single Product Free Shipping
There are several ways to achieve free shipping on a specific product in WooCommerce. We’ll explore the most effective methods:
1. Using a Free Shipping Coupon
This method involves creating a special coupon that only applies to a specific product and offers free shipping. It’s straightforward and allows for flexibility.
Steps:
1. Create a New Coupon: Go to *WooCommerce > Coupons > Add Coupon*.
2. Coupon Code: Generate a unique code (e.g., `FREESHIPPINGITEM`).
3. Discount Type: Select “Fixed product discount” and set the discount to the product’s price. This makes the item “free” during checkout as long as the coupon is applied.
4. Coupon Amount: Enter the full price of the product you want to offer free shipping on.
5. Allow Free Shipping: Check the box “Allow free shipping.”
6. Usage Restriction: This is the crucial step. Under “Usage Restriction,” find the “Products” field and select the specific product that should receive free shipping. Optionally, you can restrict it to specific product categories as well.
<?php
// Example of restricting the coupon programmatically (advanced use)
add_filter( ‘woocommerce_coupon_is_valid’, ‘restrict_coupon_to_product’, 10, 2 );
function restrict_coupon_to_product( $is_valid, $coupon ) {
global $woocommerce;
$product_id = 123; // Replace with your product ID
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( $cart_item[‘product_id’] == $product_id ) {
return true; // Coupon is valid if the specified product is in the cart
}
}
return false; // Coupon is not valid if the product is not in the cart
}
?>
7. Publish/Update the Coupon: Click “Publish” to activate the coupon.
Pros:
- Relatively easy to set up.
- Provides a clear incentive for customers.
- Good for promotional campaigns.
- Trackable using coupon usage statistics.
- Requires customers to enter a coupon code.
- Can be confusing if not clearly explained.
- Customers might forget to apply the coupon.
- More flexible and powerful than coupon-based solutions.
- Can create complex shipping scenarios.
- Often integrates well with other WooCommerce extensions.
- Can be automated, so no coupon code is required.
- Requires installing and configuring a third-party plugin.
- Can be more complex to set up, especially for advanced rules.
- May have associated costs (premium plugins).
Cons:
2. Using a Plugin (e.g., Conditional Shipping and Payments)
Several WooCommerce plugins, such as “Conditional Shipping and Payments” or similar, provide more advanced control over shipping options. These plugins allow you to create rules based on cart contents, product categories, and other factors.
Steps (General Plugin Approach):
1. Install and Activate the Plugin: Install the plugin from the WordPress plugin repository or upload it if you have a premium version.
2. Configure Shipping Rules: Access the plugin’s settings (usually found under WooCommerce or in the WordPress settings menu).
3. Create a New Rule: Create a rule that checks if the specific product is in the cart.
4. Set Shipping Options: If the product is in the cart, set the shipping cost to zero (free). If not, use your default shipping rates.
Pros:
Cons:
3. Programmatically Adding Free Shipping (Advanced)
For developers, you can modify the WooCommerce shipping calculations directly using PHP code. This provides the greatest level of control but requires coding expertise.
Steps:
1. Add Code to `functions.php` or a Custom Plugin: Add the following code to your theme’s `functions.php` file (use a child theme to avoid losing changes during theme updates) or a custom plugin.
<?php add_filter( 'woocommerce_package_rates', 'conditional_free_shipping', 10, 2 );
function conditional_free_shipping( $rates, $package ) {
$product_id = 123; // Replace with your product ID
$found = false;
// Check if the specific product is in the cart
foreach ( $package[‘contents’] as $cart_item ) {
if ( $cart_item[‘product_id’] == $product_id ) {
$found = true;
break;
}
}
if ( $found ) {
// Remove other shipping rates
$free_shipping = array();
foreach ($rates as $rate_id => $rate) {
if (‘free_shipping’ === $rate->method_id) {
$free_shipping[$rate_id] = $rate;
break;
}
}
if(!empty($free_shipping)) {
return $free_shipping; // Only free shipping available.
} else {
// Create a new “free shipping” rate if none exist
$free = new WC_Shipping_Rate();
$free->id = ‘custom_free_shipping’;
$free->label = ‘Free Shipping for This Item!’;
$free->cost = 0.00;
$free->taxes = false;
$rates = array( $free->id => $free );
return $rates;
}
}
return $rates; // Return original rates if product not found.
}
?>
2. Replace the Product ID: Change `123` to the actual ID of the product you want to offer free shipping on.
3. Customize the Code (Optional): Modify the code further to suit your specific needs, such as adding conditions based on the product category, or cart total.
Pros:
- Maximum control and flexibility.
- Can create highly customized shipping rules.
- Avoids the need for third-party plugins (can improve site performance).
Cons:
- Requires coding knowledge.
- Can be complex to implement and debug.
- Theme updates can overwrite changes made to `functions.php` (use a child theme).
Conclusion:
Offering free shipping on a single product can be a strategic move to boost sales and customer satisfaction. The best method depends on your technical expertise, your budget, and the complexity of your shipping needs. A free shipping coupon provides a simple and effective way to achieve this. For more intricate scenarios, a dedicated WooCommerce shipping plugin offers greater flexibility. Developers with coding skills can leverage programmatic solutions for ultimate control. Remember to thoroughly test your chosen method to ensure it functions as expected and provides a seamless experience for your customers. By carefully implementing one of these techniques, you can effectively offer free shipping on a single product and reap the benefits of increased sales and customer loyalty.