I found a solution to the problem.
This code remove the validation of the custom fields if the Local Pickup method is selected.
add_action('woocommerce_after_checkout_validation', 'thwcfe_remove_unwanted_error', 11, 2);
function thwcfe_remove_unwanted_error($data, $errors){
if (isset($data['shipping_method']) && $data['shipping_method'][0] == ' local_pickup:8') {
$errors->remove(' billing_region');
$errors->remove(' billing_cityalt');
}
}
Related Posts:
- How to get current product category ID in product archive page
- WooCommerce prices location in DB
- WP/WooCommerce REST API cart/checkout/order [closed]
- Adding an action within a function that is being called by add_filter
- Hide Add to Cart Button
- How to modify “[Product] has been added to your cart” in WooCommerce?
- Why do Woocommerce templates use hooks rather than get_template_part
- Display WooCommerce only in stock sizes product attribute on shop page
- How to stop a Gutenberg Block from firing multiple GET Requests?
- Woocommerce Product Price Inserted programmatically doesn’t get displayed In Single Product Page
- How to Order by random on a SQL query
- Hide “Delete Note” link in Order Notes Panel
- Exclude products with a stock lower than the low stock threshold from the shop loop [closed]
- Remove Order List Row Link in WooCommerce Admin?
- Unable to update Woocommerce Product Permalink
- wp_customize – detect post type to show/hide customizer options
- WooCommerce – Display nested list of all subcategories on archive-product.php
- woocommerce cart item remove ajax not working in hosted site [closed]
- Set woocommerce product price based on dealer location [closed]
- How can I custom order the product display?
- WordPress plugin cloak link [closed]
- Woocommerce REST API – updating an order changes custom tax calculations
- How to list all WC products by their attributes values?
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- WordPress WooCommerce: How to allow only specified customers to pay by check? [closed]
- WordPress Comment Box on woocommerce product page [closed]
- Remove Bulk Action For non admin user
- Add max-value to hooked quantity selector in woocommerce [closed]
- Can’t remove woocommerce sidebar
- Woocommerce Slow Queries
- How to display the percentage of the applied tax in woocommerce [closed]
- woo product , wp_insert_post() never displays on the front end. What gives? [closed]
- Disabling shopping basket in WooCommerce [closed]
- Single product page doesn’t display price
- Should I use docker in wordpress production?
- can’t get the product id in single woocommerce page
- Php echo woocommerce price
- Different files for order details
- Multiple Schema.org markups on a single product page
- Woocommerce – Adding row to cart table
- Hide a product with a certain tag from product-category
- Custom rewrite for product variation not working
- Block Disposable Emails on Woocommerce Registration
- Can’t Change WooCommerce Default Language to Spanish (Mexico)
- Adding of custom cart item data via Ajax Add to Cart
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- Error message if user is buying less than 200 euros of a given product [closed]
- WooCommerce show a variation both in check boxes and in a list
- Woocommerce – How to mix products and posts on a landing page?
- Disable woocommerce product search plugin’s autocomplete [closed]
- Manual Admin Orders search for billing_company
- Use woocmmerce function on theme and override them
- Woocommerce Checkout Page Total Price Inside Google Pay Script
- How to hide order action button after changing order status to completed
- How to get rid of variations with unspecified attributes
- Deregister dequeue JS scripts except on 1 product page
- How to show price update date in product single page?
- Woocommerce Rest API: woocommerce_product_invalid_image_id
- How do I disable “Flat Rate” radio button and remain with other shipping method in woocommerce
- How to add woocommerce product price filter widget to other page
- How to get users data from wordpress woocomerce database to display
- Simple thing esc_url query
- Woocommerce on Subdirectory
- Change WooCommerce state and city checkout fields to dropdowns related to the chosen country
- How to apply a custom coupon to a WooCommerce Subscription recurring amount?
- How to send an automatic email to a custom field in Woocommerce order meta 2 weeks after a product is bought
- WooCommerce: How can I add a certain product to the cart and redirect to the cart from a non-shop page?
- Make Woocommerce breadcrumbs show up using functions.php file
- Alter the cost of products using phpmyadmin sql query
- How does one allow any customer to process any order in store on woocommerce?
- WooCommerce CSV Image URL Creates Additional Images in Media Folder
- Custom changes performed on WP + WooCom site on maintenance subdomain. How to perform a migration to a main domain?
- Update products with curl (bash)
- Woocommerce Child Category Permalink Structure Change
- Allow customer to choose an optional free/paid product to add to their order (and reduce stock reduced & record sale)
- How to restrict type/size of file uploads in any plugin?
- In woocommerce some products have empty options, but how to check this
- Stop the “upload file size” error from printing [closed]
- How to disable the “Upgrade or Downgrade” button in “My account” of WooCommerce Subscriptions
- WooCommerce – Inconsistent Indexing of Orders
- How to show woocommerce login / registration form in modal
- How to remove slug from Product category URL in Woocommerce
- Removing ‘woocommerce-no-js’ class from body
- url rewrite doesn’t load woocommerce product
- Woocommerce – display all sold out products
- Woocommerce how to show most selling products by category
- AffiliateWP not calculating multiple quantities when using affwp_calc_referral_amount filter
- Hide a shipping method if cart total is higher than an amount
- error 500 in Back Office when using a woocommerce function in functions.php
- Send data to external websites when there is an update or create a post
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- How to update all products with same SKU prefixes when updating stock with CSV?
- What is the best and cheapest way to generate dashboards about conversions data and store users? [closed]
- Sort by price when price is set in multiple keys
- Add a custom code with custom link after add to cart for every product
- WooCommerce product permalink based on product’s current category
- Disable duplicate WC product category URLs
- how should i get products based on tags in woocommerce
- Add custom text to product category page
- Woocommerce permalink URL change in DB