How To Disable WooCommerce Shipping Methods for Certain Products
Shipping and payment methods are critical for any eCommerce shop. The availability of particular alternatives may also have an impact on your store’s conversion rate. You may also choose to limit the availability of specific shipping and payment methods based on various factors. For example, you could wish to restrict shipping and payment options based on the customer’s region or specific product requirements.
Today’s tutorial will show you how to disable WooCommerce shipping methods for certain products. One of the most tried-and-true strategies for raising conversion rates in an e-commerce site is to provide free delivery. It improves consumer retention and reduces frequent cart abandonment. Unfortunately, WooCommerce lacks built-in functionality that allows you to choose which WooCommerce shipping methods should be exposed on the cart page and which should be hidden. So, let’s dive in!
Why do we need to disable WooCommerce shipping methods for specific products?
WooCommerce, as an eCommerce platform, also offers delivery options such as free shipping, flat cost, and local pickup, which may be configured for different shipping zones based on geography. For example, free shipping is only provided for a limited number of postcodes near the store location, while flat rate shipping is accessible for the remainder of the delivery zones. The plugin makes it simple to provide location-based shipping alternatives, but it makes it harder for business owners to do so in cases when location isn’t critical.
The circumstances might be as follows:
- Particular shipping methods, such as free shipping, should not be offered if the order weight exceeds a certain amount of pounds or kilograms.
- Some delivery methods’ availability is also determined by the number of quantities or the total price of the order. For example, if the purchase amount exceeds $250, only free delivery options should be accessible, with no paid shipping methods. There may be other criteria for which shipping methods must be displayed or concealed throughout the checkout process, but we will just cover the two in this post. To do this for your WooCommerce store, you may add a code snippet or utilize one of the existing shipping rate plugins.
How to disable shipping methods for certain products in WooCommerce
Method 1: Coding
Consider the first criterion mentioned above, which states that free shipping should not be provided if the order weight exceeds 5 kgs. You may accomplish this by inserting the following code into the functions.php file of the currently active theme. These modifications may be overwritten if the current theme is updated. Thus it is best to build a child theme and include the necessary code snippets in its functions.php file. You may also use the Code Snippets plugin to add custom snippets.
/**
* Hide free shipping when the order weight is more than 10kgs.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function ts_hide_free_shipping_for_order_weight( $rates, $package ) {
$order_weight = WC()->cart->get_cart_contents_weight();
if ( $order_weight > 5 ) {
foreach( $rates as $rate_id => $rate_val ) {
if ( 'free_shipping' === $rate_val->get_method_id() ) {
unset( $rates[ $rate_id ] );
}
}
}
return $rates;
}
add_filter( 'woocommerce_package_rates', 'ts_hide_free_shipping_for_order_weight', 100, 2 );
The woocommerce_package_rates filter is used here to change the estimated rates on the cart. It includes all of the shipping prices accessible after the product is put into the shopping cart. So, if the order weight exceeds 5kgs, we must remove the needed shipping option, which in our instance is Free shipping, from the array provided by this filter.
Another example of concealing shipping methods on WooCommerce Cart is enabling free shipping at checkout if the order total exceeds $250. This may be accomplished by inserting the following code into the functions.php file.
/**
* Hide shipping rates when order total is more than $250.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function ts_hide_shipping_for_order_total( $rates ) {
$free = array();
$order_total = WC()->cart->get_subtotal();
if( $order_total > 250 ) {
foreach ( $rates as $rate_id => $rate ) {
if ( 'free_shipping' === $rate->get_method_id() ) {
$free[ $rate_id ] = $rate;
}
}
}
return ! empty( $free ) ? $free : $rates;
}
add_filter( 'woocommerce_package_rates', 'ts_hide_shipping_for_order_total', 100 );
When the order amount exceeds $250, the filter returns an array of just free shipping options; otherwise, all shipping rates are provided.
In the preceding instances, we utilized the Free Shipping method as a reference. Therefore the method ID is free_shipping. The method IDs for changing additional delivery methods are:
- Local pickup: local_pickup
- Flat Rate: flat_rate
The get_method_id() function retrieves the method id only for the three methods across all shipping zones, not for a single process inside a single shipping zone. Hence it hides all flat rates, local pickup, and free shipping ways accessible during checkout. However, if you wish to disable a particular shipping method, you must use the combination of the shipping method ID and the instance ID. For example, ‘flat_rate:3’, where 3 is the unique instance ID maintained in the database for each shipping method for a zone. You may determine the instance ID of the shipping method by right-clicking on it and inspecting the element in your browser’s developer tool.
Method 2: Using the third-party plugin
Let’s look at how you can easily deactivate the WooCommerce Shipping Method for Specific Products on your WooCommerce shop using the WooCommerce hide shipping plugin. We may accomplish this by utilizing the ELEX Hide WooCommerce Shipping Methods Plugin. If you wish to limit available delivery alternatives based on various factors, this plugin may be one of the most comprehensive options. You may use the plugin to disable the default WooCommerce shipping methods and those offered by third-party plugins. Shipping methods can be hidden based on the product, category, delivery class, location, order weight, availability of alternative shipping methods, and so on. Depending on your strategy, you may want to create different rules to hide specific distribution methods. Surprisingly, the plugin also lets you hide certain shipping business services. Shipping methods can also be withheld based on the user’s role.
Let’s go through how to disable the WooCommerce delivery method for certain WooCommerce products:
- Install and activate the plugin on your WooCommerce store.
- To begin, choose a product for which you wish to conceal the delivery method. You may hide certain goods in the plugin by using a unique SKU number. Consider the goods with SKUs such as HOODIE-PATIENT-NINJA and POSTER-FLYING-NINJA.
- You may simply add these SKUs into the WooCommerce hide shipping plugin and then conceal express shipping for the same. When Free Shipping alternatives are offered on the cart with these goods, the settings say that any specific Shipping option should be hidden.
- Mention the shipping choice you wish to hide on the following tab. According to the regulation mentioned above, if a product with certain SKUs arrives in the basket, the flat Rate must be disabled.
- You may see the cart page once you set this rule.
3 other best plugins to disable WooCommerce shipping methods for certain products
Conditional Shipping and Payments
The Conditional Shipping and Payments for WooCommerce plugin allows you to restrict specific items based on their location. It will also enable you to collect subscription payments just through a particular payment channel. You may use this plugin to control your site’s delivery methods and payment options based on conditional logic. Depending on the product, category, or shipping class, you may handle free shipping and other delivery methods on your website. You may also confine payment options so that particular gateways are only available to specified clients or user roles. Overall, the plugin is beneficial for managing your workflow when you have a comprehensive product catalog and many shipping and payment options.
Outstanding features:
- Allows you to create rules that expose or hide shipping methods depending on a variety of circumstances.
- Payment gateways can be activated and disabled on an individual basis.
- Coupons can be used to control the availability of delivery methods.
- You may quickly meet international shipping regulations by using location-specific standards.
- It is simple to integrate with popular extensions like Subscriptions and Memberships.
Price: You can get this plugin at the cost of $79 for the essential subscription.
Advanced Flat Rate Shipping Plugin For WooCommerce
Advanced Flat Rate Shipping Plugin For WooCommerce is one of the best WooCommerce Flat Rate Shipping Method Plugins, giving you a lot of versatility in adjusting shipping charges. With the support of several flat rate shipping options, you will implement an effective delivery plan. You may use the plugin to construct various sophisticated rules that will apply shipping rates depending on frequent purchase patterns in your shop.
Outstanding features:
- Set the conditional rules that allow/restrict delivery methods, payment gateways, and so on at the time of checkout.
- WooCommerce flat rate shipping calculations allow you to customize delivery prices based on a variety of dynamic criteria.
- To target shipping rules that can benefit particular consumers, employ Table Rate shipping costs depending on users.
- Apply Lowest or Highest — Depending on the circumstances, apply the most minor or most outstanding shipping charge to consumers.
- Classify certain items and assign them bespoke delivery prices.
Price: The plugin will cost you at least $99.00 for a single site license.
Hide Shipping Method For WooCommerce
The Hide Shipping Method For WooCommerce plugin will allow you to optimize your WooCommerce store’s shipping strategy. It will assist you in creating sophisticated conditions that will limit the application of various delivery methods. The plugin provides you a lot of flexibility in hiding shipping options based on product attributes, delivery location and time, and so on. Furthermore, you may regulate your shipping strategy by combining numerous rules and creating complex circumstances. Moreover, the plugin makes it very simple to create conditions that conceal additional shipping options when free shipping is offered. The plugin is straightforward to install and set up.
Outstanding features:
- Use this plugin to disable any number of shipping methods, whether a few specific ways or all of them.
- Create basic/advanced hiding shipping rules based on delivery dates, day, time, management, product attributes, and various other factors.
- Add numerous basic rules and apply them when all or any of the basic rules are the same.
- Configure multiple hidden shipping rules or hide various shipping methods from the shopping page when free shipping is offered.
- It takes only a few minutes and requires no technical skills to install on your WooCommerce store.
Price: This plugin will cost you at least $49.00 for a single site license.
Conclusion
Depending on the circumstances of the products, shipping might be a difficult task for eCommerce store owners. You may specify a fixed shipping charge per order, item, or shipment class using WooCommerce’s default flat rate shipping option. When you have consumers from all over the world and your items are vastly diverse, the primary selections will not suffice. You’ll need to invest in specific plugins that allow you to set complex flat-rate choices.
We hope this article will help you understand how to disable WooCommerce shipping methods for certain products. You can vary to use both ways above and take advantage of these plugins listed. Take a deep look at your store to find the most appropriate options to manage your shipping process and peak sales!