Phone cannot be set as required
-
Hello there!
From what I understand,
billing_phone
is required by default in Woocommerce 3.5.7. Yet, it is currently optional (and always has been from what I can recall). I’ve been trying to make it a required field, injecting the snipped below (taken from https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/) infunctions.php
:add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 ); function wc_npr_filter_phone( $address_fields ) { $address_fields['billing_phone']['required'] = true; return $address_fields; }
But this code isn’t working either: the field remains optional. I’ve already done something similar to add a custom country, and that worked just fine. Does anyone know what’s going on, where the problem is…?
Worth noting: if you’re going to the link I’m providing, know that it will only show the billing form after you have added a product to your cart.
Thanks!
The page I need help with: [log in to see the link]
- The topic ‘Phone cannot be set as required’ is closed to new replies.