How to Hide Woocommerce Shipping Options Conditionally (15 Easy Hacks)
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
Probably the best channel ever found. Love the content.. Best snippets ever!
Thank you for the support 🙂
You rock. Your videos are amazing. Thank you.
I appreciate that!
Love your videos too much helpful God bless you.. 💕
Thank you so much!
Such a WordPress professor
Lol 😋
i love you man
:)
Thank you for sharing. I have a question on shipping classes. I will appreciate your assistance.
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.
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
Sorry, I myself don’t use product sliders and therefore can’t help with that.
Great snippet. But then in orders it doesn't show what customer picked DPD, Omniva or other delivery service.
What do you mean by that?
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.
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
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?
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)
The "Remove "ship to a different address" if Local Pickup is selected" code doesn't work
I just tested on my site and it works well.
@@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
@@wpsimplehacks It 'halfway' works for me. If the customer changes a shipping method, it doesn't work unless the page is refreshed
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?
Probably you didn’t use the correct local pickup ID in the code.
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?
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.
@@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.
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?
It would be wise to ask this question directly to the Stripe team. Although, here's the Stripe countries list stripe.com/global
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.
Do you mean single gallery thumbnails or something else? Why would you need to convert them to buttons.
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
It would be wise to open up a support ticket on Blocksy site and ask them about it.
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
good video
Glad you enjoyed
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 .
What do you mean by that?
@@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
See whether this plugin shown in this video will help you out czcams.com/video/RGXfTKjsUaM/video.html
@@wpsimplehacks Thank you sir, Please never stop making videos, your videos are the best
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?
Then no shipping methods are displayed. :)
Hi man, could you show how disable shipping method based on choosen payment method??
Sorry, can’t help with that.
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?
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/
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
Sorry, can’t help you with that.
Hello
how can i remove "ship to different address" section for all shipping method?
Take a look whether this helps you out njengah.com/disable-ship-to-another-address-option/
@@wpsimplehacks tahnk u you are the best
how to remove shipping address down of delivery charge in cart page
Woocommerce settings >> Shipping
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
Set your products as virtual products. These won't need shipping
@@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
Where do you get coxes from ? Im confused
As I said in the video: link to the snippets are in the video description 🙂
Thank you@@wpsimplehacks
Hello sir , is there any way to add free shipping based on the payment method??
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
😇
@@wpsimplehacks thank you sir , I'll try that 😊
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).
What do you mean by that? Do you mean variation gallery or anything else?
Codes*
🙂
Please sir its a request
:)
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; }
Sorry, can’t help with that. It would be wise to ask support from the booking plugin support team.