Support » Plugin: WooCommerce » WooCommerce – Hiding free shipping from certain products

  • I have an online store where most items are under $50. There are flat rate postage costs, and if you spend over $100 you get free shipping.

    The problem is I do have a handful of products that are more than $100, and are rather large and/or heavy, thus the postage rates will be higher.

    I did the obvious and added custom additional postage charges to those particular items, however, when in the cart, the ‘free shipping’ is still an option for them to select because they are over the $100.

    My question is…is it possible to hide, or deactivate, the free shipping for these specific products?

    Thanks in advance!


Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    Do you have the other rates setup so that they only show on the products that are larger/heavy and do not qualify for free shipping?

    if so the following code should work, as it hides free shipping when there are other available methods.

    That needs to be placed in your themes functions.php file.

    Thanks 🙂

    Sorry, I’m not quite sure what you mean? All I’ve done is create certain shipping classes, say “heavy”, and attached the shipping class to whatever product is overly heavy.

    I do have that code you provided already, and it works well, but that is something different.

    So say I have a product that is $599, so obviously it qualifies for the over $100 free shipping. On the cart page, the only option it has is free shipping. So somehow I have to exclude this product from qualifying for free shipping and display a flat rate instead (based on the shipping class I attached).



    Hi Yifa, im having this exact same problem…. have you found a way to make this work?



    How’s this:

    This will automatically disable/hide the free shipping method if any product is in the cart that is in one of the selected shipping classes or product categories



    I found a snippet to do this for free simply by adding it to your function.php file:

    */ Disable free shipping for select products
    * @param bool $is_available
    function my_free_shipping( $is_available ) {
    global $woocommerce;
    // set the product ids that are ineligible
    $ineligible = array( '14009', '14031' );
    // get cart contents
    $cart_items = $woocommerce->cart->get_cart();
    // loop through the items looking for one in the ineligible array
    foreach ( $cart_items as $key => $item ) {
    if( in_array( $item['product_id'], $ineligible ) ) {
    return false;
    // nothing found return the default value
    return $is_available;
    add_filter( 'woocommerce_shipping_free_shipping_is_available', 'my_free_shipping', 20 );

    Replacing the $ineligible array for your product number you will exempt those products from free shipping. Works like a charm.

    Found this info here:

    Very helpful. Hope it helps those that are looking for a free solution.

    Hey @palexandra glad you found that info on my blog – and glad it’s helping. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WooCommerce – Hiding free shipping from certain products’ is closed to new replies.