mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/68524314/disable-chrome-autocomplete-dropdown-suggestions-on-woocommerce-checkout
15 lines
422 B
Text
15 lines
422 B
Text
add_filter( 'woocommerce_form_field', 'change_autofill', 1, 1 );
|
|
|
|
function change_autofill( $field) {
|
|
|
|
$agent = $_SERVER['HTTP_USER_AGENT'];
|
|
|
|
if (strpos($agent, 'Firefox') !== false) {
|
|
$field = str_replace('autocomplete="address-line1"', 'autocomplete="off"', $field);
|
|
return $field;
|
|
}
|
|
else {
|
|
$field = str_replace('autocomplete="address-line1"', 'autocomplete="none"', $field);
|
|
return $field;
|
|
}
|
|
}
|