Empty cart after checkout
This commit is contained in:
parent
12dc8220e9
commit
ee2384595a
2 changed files with 8 additions and 0 deletions
|
@ -61,6 +61,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
|
|||
"data": cartData,
|
||||
};
|
||||
|
||||
await clearCart();
|
||||
|
||||
var statusCode = await loadCheckout(data);
|
||||
return statusCode;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue