How to Hide Woocommerce Shipping Options Conditionally (15 Easy Hacks)

Sdílet
Vložit
  • čas přidán 30. 07. 2024
  • In this full complete guide, I will show you how to hide Woocommerce shipping methods conditionally without any extra plugin. Before you jump in a quick comment though: all the snippets shown below will go to either to your child theme’s functions.php file or, better yet, use Code Snippets plugin for it (like I do).
    All the snippets shown in the video are here: wpsimplehacks.com/how-to-hide...
    Blocksy and Kadence are currently two of the best WordPress themes. So, if you’re interested, then you can grab:
    🅱️ Blocksy theme wpsimplehacks.com/blocksy (SAVE 10% Coupon WPSH10)
    🔵 Kadence theme here: wpsimplehacks.com/kadence (SAVE 10% Coupon SIMPLEHACKS)
    ✅ If you want to be the first to be notified about the new tutorials then please subscribe to this channel. / @wpsimplehacks
    ✅ BEST WORDPRESS THEMES:
    Blocksy theme: wpsimplehacks.com/blocksy (SAVE 10% Coupon WPSH10)
    Kadence Theme: wpsimplehacks.com/kadence (SAVE 10% Coupon SIMPLEHACKS)
    Astra Theme: wpsimplehacks.com/astra
    GeneratePress: wpsimplehacks.com/generatepress
    OceanWP: wpsimplehacks.com/oceanwp (SAVE 10% Coupon WPSH10)
    ✅ AWESOME WORDPRESS PLUGINS:
    WPCodeBox wpsimplehacks.com/wpcodebox (SAVE 20% Coupon WPSH20)
    WooLentor Elementor/Gutenberg add-on wpsimplehacks.com/woolentor (SAVE 20% Coupon WPSH20)
    Best Wordpress Backup, Migration and Staging plugin - WpVivid Pro wpsimplehacks.com/wpvidid (SAVE 20% Coupon WPSH20)
    Best Gutenberg Blocks addon - Kadence Blocks wpsimplehacks.com/kadenceblocks (SAVE 10% Coupon SIMPLEHACKS)
    Best forms plugin - Fluent Forms: wpsimplehacks.com/fluentforms (SAVE 20% Coupon: WPSH20)
    WP Social Ninja wpsimplehacks.com/socialninja (SAVE 20% Coupon: WPSH20)
    Best for email marketing - Fluent CRM: wpsimplehacks.com/fluentcrm (SAVE 20% Coupon: WPSH20)
    Best for creating tables - Ninja Tables wpsimplehacks.com/ninjatables (SAVE 20% Coupon: WPSH20)
    Best Wordpress LMS - Tutor LMS wpsimplehacks.com/tutorlms (SAVE 20% Coupon thmwelcome20)
    Best Wordpress SEO plugin - SEOPress wpsimplehacks.com/seopress
    Image Map Pro - wpsimplehacks.com/imagemap
    ✅ AWESOME WOOOCOMMERCE EXTENSIONS:
    Best Woocommerce Swiss Knife tool - Kadence WooExtras wpsimplehacks.com/wooextras (SAVE 10% Coupon SIMPLEHACKS)
    Advanced Dynamic Pricing Pro wpsimplehacks.com/dynamic-pri... (SAVE 20% Coupon: WPSH20)
    Phone orders For Woocommerce Pro wpsimplehacks.com/phone-order... (SAVE 20% coupon: WPSH20)
    Advanced Orders Export Pro wpsimplehacks.com/export-orde... (SAVE 20% coupon: WPSH20)
    Best Woocommerce sidecart plugin - Woocommerce Cart in One wpsimplehacks.com/cartinone
    TIMESTAMPS
    00:00 How to conditionally hide Woocommerce shipping options
    00:35 Code Snippets vs functions.php?
    01:12 Disable Woocommerce shipping methods for a specific shipping class
    03:20 Hide woocommerce checkout fields when local pickup is selected
    04:39 Hide Woocommerce Checkout Fields Based on Shipping Methods
    07:19 Display store address for Local pickup shipping method
    08:37 Disable Woocommerce shipping methods for specific category
    10:16 Disable shipping methods for specific tags
    10:55 Disable shipping methods for specific products
    12:20 Disable shipping methods for specific variations
    14:15 Disable shipping methods based on cart subtotal
    16:13 Disable shipping methods based on cart weight
    17:37 Disable all shipping rates when free shipping is available
    18:10 Hide all shipping rates when free shipping is available, but keep “Local pickup
    18:44 Disable shipping methods based on user roles
    21:01 Remove “ship to a different address” if Local Pickup is selected
    21:48 Remove “ship to a different address” only for specific products
  • Jak na to + styl

Komentáře • 73

  • @AL_TheGrayWolf
    @AL_TheGrayWolf Před rokem +4

    Probably the best channel ever found. Love the content.. Best snippets ever!

  • @pixelgap
    @pixelgap Před 2 lety +1

    You rock. Your videos are amazing. Thank you.

  • @Usama1333
    @Usama1333 Před rokem

    Love your videos too much helpful God bless you.. 💕

  • @hahahuhu832
    @hahahuhu832 Před 2 lety +1

    Such a WordPress professor

  • @Whyayk
    @Whyayk Před 2 lety

    i love you man

  • @doreenaura6405
    @doreenaura6405 Před 2 lety

    Thank you for sharing. I have a question on shipping classes. I will appreciate your assistance.

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      Hi, I received your email, but unfortunately I am unable to help you with it because this is a custom work that needs more work.

  • @Jiggisghoul
    @Jiggisghoul Před 2 lety

    Sir thank you really much for your work! You helped us a lot! Your community loves you we are grateful!! Pls show us some good product slider a good one with beautiful design not so trashy? Can you help us there pls

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      Sorry, I myself don’t use product sliders and therefore can’t help with that.

  • @NiceTryAmigo
    @NiceTryAmigo Před 4 měsíci

    Great snippet. But then in orders it doesn't show what customer picked DPD, Omniva or other delivery service.

  • @sasakikojuro
    @sasakikojuro Před rokem

    Hello, I hope you are doing good Mister,
    your videos are so helpful so far, I truly like the content you provide.
    I'm currently facing a problem, I want to hide shipping methods by cities, I have only 2 shipping methods which are: stopdesk and home delivery. Home dilevery is available for every city within the state, but stopdesk (local pickup) isn't available in all cities for a given state.
    You know in the same state there is multiple cities, and I want to hide stopdesk on multiple cities within the same state and make the stopdesk (local pickup) option available only for some cities within the state.
    Can you tell me please how can I do it? I'm truly in a huge problem right now, I have been searching for 6 months without finding any solution.
    Thank you.

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      Set up two shipping zones. One has hone delivery and another obe has stopdesk. Then add postal codes to either one of them - this will check whether it is allowed to use this or that zone

  • @selah_
    @selah_ Před rokem

    The "remove ship to different address if local pickup is selected" snippet worked for me, however, there seems to be a minor flaw.. It does not actually disable the toggle, it only hides the fields. Which means if the toggle was enabled to show the fields while one shipping method was selected, and the customer switches the shipping method to another that was set to hide the fields if selected, then if they try to check out, there would be an error saying that Shipping address, first name etc. is required. Is there any way to disable the toggle completely if local pickup is selected, and not just hide it, so that this issue doesn't occur?

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      Shipping fields aren’t required by default. Only billing fields are. So, maybe you have "Default to shipping address" activated (it’s under Woocommerce >> Settings >> Shipping >> Shipping options)

  • @mussagirma9975
    @mussagirma9975 Před 2 lety +1

    The "Remove "ship to a different address" if Local Pickup is selected" code doesn't work

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      I just tested on my site and it works well.

    • @mussagirma9975
      @mussagirma9975 Před 2 lety

      @@wpsimplehacks Hi, my website is in french do you think that has to do with this code not working ? The other codes seem to work

    • @bestinkgr
      @bestinkgr Před 11 měsíci

      @@wpsimplehacks It 'halfway' works for me. If the customer changes a shipping method, it doesn't work unless the page is refreshed

  • @danhew531
    @danhew531 Před rokem

    Hi, Thank you for the video! This is great! How did you hide "deliver to a different address on local pick-up? I copied your code and it's still there. Can you please help?

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      Probably you didn’t use the correct local pickup ID in the code.

  • @LarsvanRooijen
    @LarsvanRooijen Před 2 lety

    First of all: WP Simple hacks, thanks for all the great help! Your snippets have been great for hiding fields, moving the email addresses to the top of the form, and showing the local pickup address. Unfortunately, I'm running into the same problem as Mussa Girma and cannot get the 'ship to a different address to hide. My site is set up in Dutch. could this be the cause of the problem? Is there any way you could help?

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety +1

      What theme you’re using? Maybe it overrides CSS classes used on my snippet. For example: my snippet uses #customer_details .col-2 .woocommerce-shipping-fields ID and classes to hide "Ship to another address".
      Maybe your theme uses somewhat different ID-s or classes. Take a look at it by using your browser inspector and, if needed then change them accordingly.

    • @LarsvanRooijen
      @LarsvanRooijen Před 2 lety

      @@wpsimplehacks thanks for the quick response. I'm using Divi (theme). As far as i can see, i see the same classes and ID's. But to be honest, i'm pretty new in this field.

  • @abazzov7526
    @abazzov7526 Před rokem

    One more question) I struggle on adding credit card payment method. Because i live in Azerbaijan and I don’t know if Stripe support it
    Do you have any advice that what can i do about that?

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      It would be wise to ask this question directly to the Stripe team. Although, here's the Stripe countries list stripe.com/global

  • @moessiebenny546
    @moessiebenny546 Před 2 lety

    very good information. thank you. is there a possibility for the single product page to change the thumbnails to bullet buttons. I've searched all over but couldn't find anything about this.
    please let me know. Thanks in advance for this nice explanation.

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      Do you mean single gallery thumbnails or something else? Why would you need to convert them to buttons.

    • @moessiebenny546
      @moessiebenny546 Před 2 lety

      it is for the single product gallery thumbnails. (mobile) it is for an air conditioning company with more than 5 extra photos. and that really doesn't look good on mobile version. and I want to make the single product page a bit quieter, but with all the amenities. I hope there is a possibility to do this with blocksy. because I want to use as few plugins as possible for this website. thank you for the effort. Greetings Moessie from the Netherlands

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      It would be wise to open up a support ticket on Blocksy site and ask them about it.

    • @moessiebenny546
      @moessiebenny546 Před 2 lety

      thank you for your quick response.
      I have created a support ticket and unfortunately there is no
      option to create bullet points for the single gallery
      not even in the pro version.
      Thank you in advance for your effort
      and if there is an opportunity somewhere, I'd love to hear it.
      greetings from the Netherlands
      Moessie

  • @advanced-developers
    @advanced-developers Před 2 lety

    good video

  • @josedanielserratebasma3371

    You are the best, Is it possible to add a buttom at the top of the checkout page to select local pick up? Please i couldnt find any plug in or code to do that, you will help a lot .

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      What do you mean by that?

    • @josedanielserratebasma3371
      @josedanielserratebasma3371 Před 2 lety

      @@wpsimplehacks My trouble is that on cell phones first you have to complete the checkout fields and then you choose the shipping method, i wan to know if there is a way to first choose the shipping method and then complete the fields

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety +1

      See whether this plugin shown in this video will help you out czcams.com/video/RGXfTKjsUaM/video.html

    • @josedanielserratebasma3371
      @josedanielserratebasma3371 Před 2 lety

      @@wpsimplehacks Thank you sir, Please never stop making videos, your videos are the best

  • @dustinfinlinson3203
    @dustinfinlinson3203 Před rokem

    What if your cart has one items that hides local pickup in favor of flat rate or free shipping and another item the hides the flat rate or free shipping in favor of local pickup?

  • @joesuarez6322
    @joesuarez6322 Před 2 lety

    Hi man, could you show how disable shipping method based on choosen payment method??

  • @Whyayk
    @Whyayk Před 2 lety

    hi i just want to know if i want to ship free to specific state or pincode and charge money to other states how it can be possible?

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety +1

      Woocommerce >> Settings >> Shipping zones. Set up zones with different pricing, and if needed you can set them up by using postal codes. See official docs woocommerce.com/document/setting-up-shipping-zones/

  • @bobobebe
    @bobobebe Před rokem

    Hi, I wonder if there is a code for
    Show Free shipping and Hide flat rate and its amount when the order is above 15 USD

  • @abazzov7526
    @abazzov7526 Před rokem

    Hello
    how can i remove "ship to different address" section for all shipping method?

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      Take a look whether this helps you out njengah.com/disable-ship-to-another-address-option/

    • @abazzov7526
      @abazzov7526 Před rokem

      @@wpsimplehacks tahnk u you are the best

  • @banatcollections527
    @banatcollections527 Před 8 měsíci

    how to remove shipping address down of delivery charge in cart page

  • @Mohammedakhlaq-qr2fy
    @Mohammedakhlaq-qr2fy Před rokem

    How do you offer the customer an option for no shipping required. this is if a customer wants to sort out their own shipping method

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      Set your products as virtual products. These won't need shipping

    • @Mohammedakhlaq-qr2fy
      @Mohammedakhlaq-qr2fy Před rokem

      @@wpsimplehacks understood but what of customers want to arrange their own shipping? so i wanted to offer an option (checkbox) on checkout asking if you want shipping or not

  • @abazzov7526
    @abazzov7526 Před rokem

    Where do you get coxes from ? Im confused

    • @wpsimplehacks
      @wpsimplehacks  Před rokem

      As I said in the video: link to the snippets are in the video description 🙂

    • @abazzov7526
      @abazzov7526 Před rokem

      Thank you​@@wpsimplehacks

  • @iamshekhu37
    @iamshekhu37 Před 9 měsíci

    Hello sir , is there any way to add free shipping based on the payment method??

    • @wpsimplehacks
      @wpsimplehacks  Před 9 měsíci

      Solution 1: letmegooglethat.com/?q=woocommerce+add+free+shipping+based+on+payment+gateway
      Solution 2: stackoverflow.com/questions/46121480/how-do-i-make-a-specific-payment-gateway-to-be-free-shipping-on-woocommerce
      😇

    • @iamshekhu37
      @iamshekhu37 Před 9 měsíci

      @@wpsimplehacks thank you sir , I'll try that 😊

  • @chiragjain718
    @chiragjain718 Před 2 lety

    Sir, i see your video and subscribe your channel. Please make a video on how can add options of gallery image for woocommerce variation product. And can we add wp_editor in it ( full featured).

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      What do you mean by that? Do you mean variation gallery or anything else?

  • @abazzov7526
    @abazzov7526 Před rokem

    Codes*

  • @chiragjain718
    @chiragjain718 Před 2 lety

    Please sir its a request

  • @xavimf4315
    @xavimf4315 Před 2 lety

    Can you help me with a code snippet?
    it's for bookable products.
    In the "single page" of a ALL VARIABLE BOOKABLE PRODUCTS, I want to hide the option to add the quantity, I only want to be able to add (book) "one product per variable"
    I've tried something like this and it works, but it affects all products, I need to afect ONLY VARIABLE BOOKABLE PRODUCTS.
    /** @Hide quantity using CSS */
    function hide_quantity_using_css() {
    if ( is_product() ) {
    ?>
    .quantity, .buttons_added { width:0; height:0; display: none; visibility: hidden; }

    • @wpsimplehacks
      @wpsimplehacks  Před 2 lety

      Sorry, can’t help with that. It would be wise to ask support from the booking plugin support team.