deleteCustomer method

Future<WooCustomer> deleteCustomer({
  1. required int customerId,
  2. dynamic reassign,
})

Deletes an existing Customer and returns the WooCustomer object.

Related endpoint: https://woocommerce.github.io/woocommerce-rest-api-docs/#customer-properties.

Implementation

Future<WooCustomer> deleteCustomer(
    {required int customerId, reassign}) async {
  Map data = {
    'force': true,
  };
  if (reassign != null) data['reassign'] = reassign;
  _printToLog('Deleting customer With customerId : ' + customerId.toString());
  _setApiResourceUrl(
    path: 'customers/' + customerId.toString(),
  );
  final response = await delete(queryUri.toString(), data);
  return WooCustomer.fromJson(response);
}