Skip to main content
WB2
Woo commerce REST A...
 
Notifications
Retirer tout

Woo commerce REST API - GET id client

1 Publications
1 Utilisateurs
0 Reactions
3 Vu
 lamy
(@tjoce)
Publications: 1
New Member
Début du sujet
 
[#3939]

Bonjour,

 

Comment récupérer dans l'API de Woocommere l'ID du client à partir de son email ?

La réponse est un tableau/array vide !!



$email = urlencode($customers['email']);

$url =' https://xxx.com/wp-json/wc/v2/customers?email='.$email; 

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));

curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POST, false);

curl_setopt($ch, CURLOPT_COOKIESESSION, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

$res = curl_exec($ch);

$err = curl_error($ch);

Merci


 
Posté : 01/04/2020 11:58 pm
Share: