Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 882 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove WooCommerce checkout fields values

#1
I'm trying to apply `autocomplete="off"` on my WooCommerce checkout fields but it just doesn't work.

Is there a way to do that for the checkout form?

I checked the docs and there's nothing available there. I also tried setting the default value to empty but it doesn't work either. This is when the user is not logged in of course.

[![enter image description here][1]][1]

**UPDATE:**

I tried `unset` as suggested by @smvax but it did not work as well.

add_filter('woocommerce_checkout_fields', 'default_values_checkout_fields');
function default_values_checkout_fields($fields) {
if (!is_user_logged_in()) {
unset($fields['billing_city']);
unset($fields['billing_first_name']);
unset($fields['billing_last_name']);
unset($fields['billing_company']);
unset($fields['billing_address_1']);
unset($fields['billing_address_2']);
unset($fields['billing_city']);
unset($fields['billing_postcode']);
unset($fields['billing_country']);
unset($fields['billing_state']);
unset($fields['billing_email']);
unset($fields['billing_phone']);
unset($fields['shipping_city']);
unset($fields['shipping_first_name']);
unset($fields['shipping_last_name']);
unset($fields['shipping_company']);
unset($fields['shipping_address_1']);
unset($fields['shipping_address_2']);
unset($fields['shipping_postcode']);
unset($fields['shipping_country']);
unset($fields['shipping_state']);
return $fields;
}
}

I also tried the answer **[here][2]** but it's not working as well.

Thanks


[1]:

[2]:

[To see links please register here]

Reply

#2
You can use Wordpress [**`'__return_empty_string'`**][1] with [**`woocommerce_checkout_get_value`**][2] WooCommerce filter hook to get empty values simply this way:

add_filter('woocommerce_checkout_get_value','__return_empty_string', 1, 1);

>This will empty all checkout values, when checkout page is loaded.

*The Code goes in functions.php file of your active child theme (or theme) or also in any plugin file.*

This code is tested and works.

> You should reset all existing sessions in Woocommerce settings > System status > tools and also the cache if your e-commerce use any.<br>
> Also empty your browser cache and stored data.

Related:

[To see links please register here]


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#3
You can set autocomplete="off" for the form fields using the woocommerce_checkout_fields filter.

````
add_filter('woocommerce_checkout_fields', 'autocomplete_off_checkout_fields');
function autocomplete_off_checkout_fields($fields) {
$fields['billing_first_name']['autocomplete'] = 'off';
return $fields;
}
}
````

This will work on all the woocommerce checkout fields.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through