deleteCart method

Future<bool> deleteCart(
  1. String cartId
)

Delete cart

Implementation

Future<bool> deleteCart(String cartId) async {
  try {
    final response = await _client.guestRequest<Map<String, dynamic>>(
      '/rest/V1/guest-carts/$cartId',
      options: Options(method: 'DELETE'),
    );

    return response.statusCode == 200;
  } on DioException catch (e) {
    throw Exception('Failed to delete cart: ${e.message}');
  } catch (e) {
    throw Exception('Failed to delete cart: $e');
  }
}