Empty cart after checkout

This commit is contained in:
Moe Poi ~ 2023-11-10 21:52:25 +07:00
parent 12dc8220e9
commit ee2384595a
2 changed files with 8 additions and 0 deletions

View file

@ -61,6 +61,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
"data": cartData,
};
await clearCart();
var statusCode = await loadCheckout(data);
return statusCode;
}

View file

@ -37,6 +37,12 @@ Future<void> removeFromCart(productId, bool batch) async {
box.put('cart', jsonEncode(cart).toString());
}
Future<dynamic> clearCart() async {
final box = Hive.box();
box.put('cart', '[]');
}
Future<dynamic> viewCart() async {
final box = Hive.box();