I’m working on a development and I need that users already registered on my site, change their password obligatorily on the woocommerce checkout-page.
I tried the classic solution:
add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields)
{
$fields['account']['account_password'] = array(
'type' => 'password',
'required' => true,
'label' => __('Pass', 'woocommerce'),
'placeholder' => _x('Pass', 'placeholder', 'woocommerce'),
'class' => array('form-row-wide')
);
return $fields;
}
This mode only works for me when the user is registering, but not for changing their password.
Do you think I should make a wp_set_password( $password, $user_id );
? If so, where would you place the code?
I need a way to do an UPDATE
and change user_pass
from wp_users
table.
2
Answers
I tried with a mix between @Raihan code and Googling´s code but I can't change
user_pass
. With this code it dont show "Internal server error" by Woocommerce.Try it.