Aways check if has coupon code in the request.

This commit is contained in:
Ferks-FK 2023-09-17 14:31:14 -04:00
parent a471cb4021
commit 04940f040b

View file

@ -180,7 +180,10 @@ class PaymentController extends Controller
$paymentGatewayExtension = ExtensionHelper::getExtensionClass($paymentGateway);
$redirectUrl = $paymentGatewayExtension::getRedirectUrl($payment, $shopProduct, $totalPriceString);
event(new CouponUsedEvent($couponCode));
if ($couponCode) {
event(new CouponUsedEvent($couponCode));
}
} catch (Exception $e) {
Log::error($e->getMessage());
return redirect()->route('store.index')->with('error', __('Oops, something went wrong! Please try again later.'));