Hide free Shipping

General Marketplace Discussion (User’s interaction forum)

Hide free Shipping Resolved

Viewing 6 reply threads
  • Author
    Posts
    • #84355
      afieldstadium
      Participant

      Hi
      I am running a multivendor website using Wc Marketplace.

      Currently, our site has 3 vendors and each of them has their own shipping policy.

      Vendor1: Collects 2 dollar for shipping, free shipping available when customer purchase over 50 dollar

      Vendor2: collects 3 dollar for shipping, free shipping available when customer purchase over 60 dollar

      Vendor3: No shipping fee

      However I am facing free shipping problems at the moment.

      For example if customers spend more than $50 from vendor 1 and $60 from vendor 2, they will see two options:flat rate fee and free shipping.
      Thus some customer gets confused and choose flat rate fee even though they can get their order shipped free.

      Therefore I want to hide other shipping options when free shipping is available.
      As my site has multiple vendors, I want hiding other shipping options applied differently according to vendors different shipping policy.

      I have read lots of articles on this forum and tried instructions written but it did not solve my problem yet.

      <Current Status>
      1.Vendor shipping ON in admin
      2.Free shipping ON in admin(free shipping set minimum purchase price $100)
      3.Flat rate ON for each vendors(set flat rate differently from each vendors dashboard)
      4.Free Shipping ON for each vendors (set free shipping differently from each vendors dashboard)
      5.Flat rate OFF in admin

      6. Inserted Below code(child theme,functions.php)

      /**
      * Hide others shipping when free shipping is available.
      */
      function hide_shipping_when_free_is_available( $rates ) {
      $free = array();
      foreach ( $rates as $rate_id => $rate ) {
      if ( ‘free_shipping’ === $rate->method_id ) {
      $free[ $rate_id ] = $rate;
      break;
      }
      }
      return ! empty( $free ) ? $free : $rates;
      }
      add_filter( ‘woocommerce_package_rates’, ‘hide_shipping_when_free_is_available’, 100 );

      7. Cleared woocommerce Cache

      These are my current status and it is not working yet.
      Can you guys give me hand so I can hide other shipping options when free shipping is available?

      Thank you

    • #84383

      @afieldstadium, please do use this updated code :

      /**
       * Hide others shipping when free shipping is available.
       */
      function hide_shipping_when_free_is_available( $rates ) {
          $free = array();
          foreach ( $rates as $rate_id => $rate ) {
                  if ( 'Free shipping' === $rate->label ) {
                          $free[ $rate_id ] = $rate;
                          break;
                  }
          }
          return ! empty( $free ) ? $free : $rates;
      }
      add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 100 );
      Copy

      Let us know if you need any further help.

    • #84522
      afieldstadium
      Participant

      Hi
      I used the updated code above but it does not change anything.
      I can still see flat rate and free shipping options together.
      Do you have any other solutions?

      Thanks

    • #84523

      @afieldstadium, we have checked the code on our end, it should work.

      Now as you are facing this issue, please do share a temporary admin and FTP access so we can check.

      While sharing the access, don’t forget to mark the response as private.

    • #91831

      I have seen this topic because I have the same problem and I want only FREE SHIPPING to show up if it triggers.
      The above code of xpert Moumita works for me so far, but even I have two vendors in the cart it shows only a neutral cart with or without Free shipping.
      If I have only one vendor in the cart it works fine, but with more then one it does not consider the others and dont list them down seperatly.
      Maybe you can help me with that too?

    • #91896

      @sunshine-media-design.com, we need your help to understand the configuration you have added to your site. For that please share a screenshot of the admin shipping settings, each vendor’s shipping settings. We also need a video capture of the checkout flow, so we can recreate the same on our end.

      Looking for your co-operation regarding the same.

    • #98182

      I presume that your issue is resolved, since, we haven’t heard back from you.
      We are marking this thread as resolved.
      Kindly open a new thread if you face any further query.

Viewing 6 reply threads

The topic ‘Hide free Shipping’ is closed to new replies.

Buy all Marketplace addons together, check out our Bundle

Buy at Slashed Price