WebsitesMadeRight

How to Hide WooCommerce Shipping Methods

How to Hide WooCommerce Shipping Methods


Having multiple shipping and payment methods can be critical to increasing your WooCommerce store’s conversion rate. But with so many options you may sometimes need to restrict the availability of specific shipping methods based on multiple factors. For example, you might disable free shipping for certain products or regions overseas.

In this article, we will share how you can hide WooCommerce shipping methods based on various conditions for your store. Though it supports many shipping integrations, unfortunatelyWooCommerce doesn’t allow you to choose which shipping methods to display on the cart page. So, let’s deep dive into all the how’s and why’s of hiding shipping methods for WooCommerce stores.

Why Hide WooCommerce Shipping Methods?

WooCommerce without a doubt is the most popular and widely used eCommerce platform. By default, it offers you multiple shipping methods including local pickup, free shipping, and flat-rate shipping. You can also configure shipping methods based on predefined shipping zones. For instance, free shipping is only offered for a select few postal codes close to the store location and flat-rate shipping is available for the rest.

Additionally, the majority of customers find it challenging to choose a shipping option that is both advantageous and affordable. Hiding specific delivery options makes it easier for them to choose. Default WooCommerce shipping can be used for this, but it offers limited options.

Aside from location, store owners may also need to hide shipping methods based on different conditions. These conditions can be based on the following:

WooCommerce shipping classes
Product SKU
WooCommerce product categories
Order Weight
Order subtotal
Countries
Postal code
User role

A few use cases include:

If the order weight exceeds a specific threshold in pounds or kilograms, certain shipping options, such as free shipping should be hidden. For example, hide free shipping if the total order weight exceeds 5kg.
Conditioning shipping methods based on the quantity of the order. For example, if the order subtotal is above $300, hide all paid shipping methods.

Use Cases to Hide Shipping Methods

WooCommerce has multiple shipping methods and these shipping methods can be managed based on multiple factors. Some of the most common use cases are as follows:

Use Case 1: Hide Shipping Methods based on Product Category

The first scenario is to hide certain shipping methods based on product categories. You can create rules to hide shipping methods for all product categories at once or multiple rules for multiple product categories.

Use Case 2: Hide other Default Shipping Methods if Free Shipping is Available

WooCommerce provides three types of shipping methods by default. In order to hide all other shipping methods if free shipping is available, you can use multiple plugins. You can create rules for all or selective products. You can also set rules based on different conditions such as location, time, SKUs, and much more.

Use Case 3: Hide based on Shipping Classes

Based on the shipping classes you establish in your WooCommerce store, you can hide specific delivery methods. You can choose products with no shipping classes or numerous shipping classes by using any of the above plugins.

Use Case 4: Hide Shipping Methods Based on Order Weight

Based on certain order weight requirements, you can hide specific shipping methods:

For all order weights, hide
more than or equal to a particular weight
equal to or less than a given weight
equal to the weight provided
between a predetermined minimum weight and maximum

Use Case 5: Hide Shipping Methods Based on User Roles

Another case is to hide shipping methods based on user roles. You can create and manage different shipping rules for various user roles. For example, Free shipping is only available for subscribers or contributors.

Methods to Hide WooCommerce Shipping Methods

In order to hide shipping methods, you can use two different methods. You can either achieve this by using code snippets or use a third-party plugin. Both methods have their own pros and cons and now we will discuss in detail both methods.

Using Code Snippets to Hide Shipping Methods based on Various Conditions

Let’s discuss code snippets that you can use to hide shipping methods based on different conditions. We will take the above-discussed scenarios as examples of how to use code snippets to hide shipping methods.

Scenario 1: Hide shipping method based on order weight

Use the following code snippet to hide the free shipping method if the order weight exceeds a particular limit.

/**
* Hide free shipping when the order weight is more than (*)kgs.
*
* Make sure to update the snippet to change the “*” to a valid number.
*
* @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 > * ) {
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 );

You can add this code snippet to the theme editor menu of your WooCommerce store. The “woocommerce_package_rates” filter is used in the code to change the product rates on the cart page. When the order surpasses the price limit of 5kg, the above code will hide the free shipping option.

Scenario 2: Hide shipping method based on cart subtotal

The other example is hiding shipping methods when the cart exceeds a particular subtotal. Continuing the previously discussed example, you can use the following code to hide specific shipping methods if the cart subtotal exceeds $300.

/**
* Hide shipping rates when the order total is more than $300.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function ts_hide_shipping_for_order_total( $rates ) {
$free = [];
$order_total = WC()->cart->get_subtotal();
if ( $order_total > 300 ) {
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 subtotal exceeds $300, the “woocommerce_package_rates” filter returns an array of only free shipping methods.

Method 2: Using the third-party plugins to hide shipping methods

Those who are not familiar with coding can use third-party plugins to hide WooCommerce shipping methods. For most people, this is the easier option, and luckily there are a large number of plugins available in the market for this purpose. The difficult task is to select the one that fulfills your requirements. So, let’s discuss in detail some of the most useful and powerful plugins to hide WooCommerce shipping methods.

Add Custom Shipping Icons & Hide Shipping Methods

Add Custom Shipping Icons & Hide Shipping Methods

The Add custom shipping icons & hide shipping methods plugin allows store owners to hide WooCommerce shipping methods based on different conditions. The plugin enables you to hide shipping methods for different products based on multiple factors. You can also add custom shipping icons by using this plugin which is always an extra benefit. For example, you can hide other shipping methods when free shipping is available.

Another perk is the price. When compared to other plugins, it offers the most reasonable price. You can also apply conditional logic to enable free shipping based on multiple factors such as location, categories, and SKUs. Some of the major features of the plugin include:

Hide WooCommerce shipping methods based on different conditions.
If free shipping is available, hide other shipping methods.
Use conditional logic to manage shipping methods based on various conditions.
Hide shipping methods based on:

Shipping classes
Product categories
Product SKUs
Order subtotal
Total weight
location/postal code
User role

Add custom shipping icons and descriptions
Display custom shipping icons on both the cart and checkout pages.

Price: The plugin is available at only $49/yr.

Advanced Flat Rate Shipping Plugin For WooCommerce

Advanced Flat Rate Shipping Plugin For WooCommerce

Advanced Flat Rate Shipping Plugin is one of the best WooCommerce plugins that provides you the flexibility to manage shipping methods and flat rates. The plugin enables you to create an effective delivery strategy with multiple flat-rate shipping options.

With conditional rules, you can create various shipping rates based on your recurring shipping patterns. The plugin offers you features such as:

Set up conditional rules to restrict shipping methods and payment gateways on the checkout page.
Calculate shipping prices based on multiple dynamic calculation methods.
Utilize table rates shipping costs for different user roles in order to target multiple shipping rules.
Apply minimum and maximum limits to shipping charges depending on the circumstances.
Divide products into multiple sections based on price slots.

Price: The plugin is available at $99/yr.

Hide Shipping Method For WooCommerce

Hide Shipping Method For WooCommerce

You can optimize the shipping strategy for your WooCommerce store using the Hide Shipping Method For WooCommerce plugin. It will help you set up complex conditions that will restrict the use of different delivery methods. You have a lot of flexibility using the plugin to hide shipping alternatives based on product characteristics, delivery location and time, etc.

Additionally, you can control your shipping strategy by mixing various rules and producing complicated situations. Furthermore, when free shipping is provided, the plugin makes it very simple to construct conditions that hide other shipping alternatives. Installation and configuration of the plugin are simple. Major features include

You can hide any number of shipping methods by using the plugin. You can hide selective methods or all of them.
The plugin allows you to create rules to manage shipping methods based on delivery time, date, day, product, method, and multiple other factors.
Create basic rules and apply these rules to all or selective products.
Configure shipping rules for different conditions such as hiding other shipping methods when free shipping is available.
The plugin requires only a few minutes to install and configure.

Price: The plugin is available at only $129/yr.

For eCommerce store owners, shipping can be a challenging task depending on the nature of the products. While you can manage and hide shipping methods and shipping costs per order, item, or shipment class, default WooCommerce options won’t do when you have customers from all over the world and a wide variety of products. You will need to spend money on specialized plugins in order to configure sophisticated flat-rate or hidden shipping options.

We hope that this article will clarify how to hide WooCommerce shipping options for specific products. You can switch between the two methods above and use the plugins mentioned. Look closely at your store to identify the best solutions for managing your shipping procedure and peak sales.



Source link

Leave a Comment

Your email address will not be published. Required fields are marked *