Hide WooCommerce Shipping methods if free shipping is available for your selected shipping regions. Free shipping is a fantastic perk for any online buyer and significantly increases the likelihood that they will complete their transaction. WooCommerce offers free shipping as one of its accessible shipping options, but regardless of whether a customer qualifies, it will still show all available shipping alternatives to them. In this article, we will try to explain how to hide other WooCommerce shipping methods when free shipping is available. This can be done in two ways, one is through coding and the other is to use a hide shipping method plugin.

Hide WooCommerce Shipping Methods with a Code Snippet

Here, we’ll use an example where, when the Free Shipping option is available for the relevant shipping zone, all shipping options are buried. Use any code snippet plugin to add the following code to the functions.php file of the child theme to do this.

 

/**

 * Hide shipping methods when free shipping is available.

 *

 * @param array $rates Array of rates found for the package.

 * @return array

 */

function ts_hide_shipping_when_free_is_available( $rates ) {

  $free = array();

  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_when_free_is_available’, 100 );

Hide Other WooCommerce Shipping Methods when Free Shipping is Available with a plugin

To keep matters simple we will discuss only one plugin in this article to hide WooCommerce shipping methods. The plugin is Add custom shipping icons & hide shipping methods. So let’s discuss in detail how the plugin helps you to hide shipping methods in WooCommerce.

 

You can hide WooCommerce shipping methods based on conditions you specify by using the wooCommerce hide shipping method plugin. For instance, you can hide shipping methods depending on product categories and a variety of other criteria or hide delivery ways when free shipping is offered by WooCommerce. The WooCommerce conceal shipping methods plugin is a great tool for streamlining your sales process for various user roles, items, and countries.

A great user experience is necessary to boost sales at your online store. You may install the WooCommerce shipping icons plugin to produce icons that are crystal clear and allow your consumers to choose easily. Shop owners can build unique symbols with captions using the WooCommerce shipping icons plugin to make shipping options appealing and understandable. Icons can be personalized with unique graphics or carrier logos.

Hide WooCommerce Shipping Methods

hide WooCommerce shipping methods as well as shipping methods added by third-party extensions or developers using the WooCommerce free shipping hide other options plugin. You can use rules you set depending on the following to conditionally hide shipping methods:

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

Hide other WooCommerce shipping methods if free shipping is available

In accordance with the rules you define, the WooCommerce hide shipping if free available plugin enables you to hide all other shipping options when free shipping is offered. When other shipping choices, such as flat rate, and local pickup, satisfy your criteria for free shipping, you can disable them and solely enable free shipping. You may define the conditions for free shipping depending on a variety of variables, including shipping classes, product SKUs, cart subtotals, and much more, using the WooCommerce if free shipping hide other plugin.

Spread the love

Leave a Reply

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