Fire event if customer wants to "buy now"
If a customer wants to buy a single product directly, the CartController add() method fires an event. The same event has to be fired via api request. In this case it's store() method.
This commit is contained in:
parent
d8bd2cb31e
commit
75f4d9925c
|
|
@ -98,6 +98,10 @@ class CartController extends Controller
|
|||
*/
|
||||
public function store($id)
|
||||
{
|
||||
if (request()->get('is_buy_now')) {
|
||||
Event::dispatch('shop.item.buy-now', $id);
|
||||
}
|
||||
|
||||
Event::dispatch('checkout.cart.item.add.before', $id);
|
||||
|
||||
$result = Cart::addProduct($id, request()->except('_token'));
|
||||
|
|
@ -228,4 +232,4 @@ class CartController extends Controller
|
|||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue