Unable to hide fields
-
I have successfully hidden the Billing Address – Company Name, State/County fields during checkout.
I disabled both fields and unchecked the appear in boxes for:
Thank You Page
My Account – address
My Account – order
EmailsHowever they both appear at the bottom of the Billing Address screen when you edit the Billing Address.
The only way I have been able to hide them in this location is by enabling both fields again and leaving the Appear In checkboxes unticked.
However they both show up in Checkout then.
-
Hello @wngadmin
Please let me know if we are talking about conditional logic.
Conditional logic is available in the PRO version but on this forum we cannot discuss topics related to the PRO version. Please write to us directly if there are any questions about this feature.
wpdesk.net/get-support/Hi @tomaszwp,
I am not referring to conditional logic. I am talking about the functionality for hiding and showing default WooCommerce fields. The options I am referring to are ones that are available in the free version provided here.
Hello @wngadmin
I was unable to reproduce it on a test installation.
Please send us a screenshot of the address editing page and the settings of these fields.No problem sending you screenshots, and a description. What is the best email address to send these to please?
Hello @wngadmin
Images should be placed here for others to see. Please put them on file hosting and paste the link.
I am marking this topic as resolved as we have not received any new replies.
I would have provided more, information, but I am unsure how to attach images to this thread. The toolbar at the top does not allow it.
What service do you recommend that does not require registration to embed images into this topic please?
Hello @wngadmin
I think Imgur should do the trick.
Please drag and drop the screenshot files there and paste the links in the next answer.Here are the images, as you can see I have disabled the two fields in question however they still appear on the edit Billing Details section of WooCommerce > My Account > Addresses section.
What am I doing wrong please?
Hello @wngadmin
The State/County field appears because WooCommerce requires this field for the selected country (UK).
Please go to the Appearance > Customize tab. Select WooCommerce and then Checkout. Make the field with the company name hidden.
Thanks, that resolved the Company Name.
For the State/County, if I set it up like this:
The field disappears from here:
But is still present here:
It just feels odd you can hide it on checkout by disabling it, but it shows it in My Account > Addresses, but then if you enable it, it’s hidden in My Account > Addresses but then present on Checkout.
Hello @wngadmin
If that is not a problem – please run a quick troubleshooting and see if this behavior is due to a conflict.
Troubleshooting steps
- Install and activate the Storefront template
- Disable plugins which are not ours or WooCommerce.
- Disable the State/County field (just uncheck the Enable Field checkbox). Also uncheck all checkboxes in the Display On tab.
- Check if the field shows up on the Checkout page or when editing the account.
Please let me know about the result.
I will see what we can do on our test setup. Would be nice to sort this out as we are looking to go paid if we can resolve this.
Hi there I can confirm that following these steps the field still shows up:
Field visible:
General settings:
Display on:
Hello @wngadmin
The issue is that when the field is turned off (unchecking Enable field) other field settings are also turned off – including setting whether the field should be shown in the My Account tab.
This is the reason the field appears in the list.The workaround is to hide the field in the My Account tab with CSS:
div.woocommerce-MyAccount-content p#billing_state_field { display:none!important; }… and make this field not required in the functions.php file:
add_filter( 'woocommerce_billing_fields', 'woo_filter_state_billing', 10, 1 ); add_filter( 'woocommerce_shipping_fields', 'woo_filter_state_shipping', 10, 1 ); function woo_filter_state_billing( $address_fields ) { $address_fields['billing_state']['required'] = false; return $address_fields; } function woo_filter_state_shipping( $address_fields ) { $address_fields['shipping_state']['required'] = false; return $address_fields; }
The topic ‘Unable to hide fields’ is closed to new replies.