mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add prefix to guest user id generation
This commit is contained in:
parent
e68ff57572
commit
c2834df32f
2 changed files with 5 additions and 2 deletions
|
@ -108,7 +108,6 @@ class IdentityToken {
|
|||
$customer_id = $this->customer_repository->customer_id_for_user( ( $user_id ) );
|
||||
|
||||
if ( 0 === $user_id ) {
|
||||
$customer_id = uniqid();
|
||||
WC()->session->set( 'ppcp_guest_customer_id', $customer_id );
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,13 @@ class CustomerRepository {
|
|||
* @return string
|
||||
*/
|
||||
public function customer_id_for_user( int $user_id ): string {
|
||||
if ( 0 === $user_id ) {
|
||||
return $this->prefix . uniqid();
|
||||
}
|
||||
|
||||
$guest_customer_id = get_user_meta( $user_id, 'ppcp_guest_customer_id', true );
|
||||
if ( $guest_customer_id ) {
|
||||
return $this->prefix . $guest_customer_id;
|
||||
return $guest_customer_id;
|
||||
}
|
||||
|
||||
return $this->prefix . (string) $user_id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue