This commit is contained in:
Prashant Singh 2019-06-27 04:38:41 +05:30
commit c539e017fe
1 changed files with 13 additions and 7 deletions

View File

@ -215,18 +215,24 @@ class CartController extends Controller
public function buyNow($id, $quantity = 1)
{
Event::fire('checkout.cart.add.before', $id);
try {
Event::fire('checkout.cart.add.before', $id);
$result = Cart::proceedToBuyNow($id, $quantity);
$result = Cart::proceedToBuyNow($id, $quantity);
Event::fire('checkout.cart.add.after', $result);
Event::fire('checkout.cart.add.after', $result);
Cart::collectTotals();
Cart::collectTotals();
if (! $result) {
return redirect()->back();
} else {
return redirect()->route('shop.checkout.onepage.index');
}
} catch(\Exception $e) {
session()->flash('error', trans($e->getMessage()));
if (! $result) {
return redirect()->back();
} else {
return redirect()->route('shop.checkout.onepage.index');
}
}