Chapter 7 - Removal - Remove customer accounts from the database
Preparation
try {
$webService = new PrestaShopWebservice('http://example.com/' , 'ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT' , false); // Create an instance
$opt['resource'] = 'customers'; // Resource to use
opt['id'] = 3; // ID to use
$webService->delete($opt); // Delete
echo 'Client '.3.' successfully deleted!'; // If we can see this message, that means we have not left the try block
}
catch (PrestaShopWebserviceException $ex) {
$trace = $ex->getTrace(); // Retrieve all info on this error
$errorCode = $trace[0]['args'][0]; // Retrieve error code
if ($errorCode == 401)
echo 'Bad auth key';
else
echo 'Other error: <br />'.$ex->getMessage();
// Display error message{color}
}Last updated
Was this helpful?
