diff --git a/src/Form/Extension/AddToCartTypeExtension.php b/src/Form/Extension/AddToCartTypeExtension.php index b494d964..7bebfcee 100644 --- a/src/Form/Extension/AddToCartTypeExtension.php +++ b/src/Form/Extension/AddToCartTypeExtension.php @@ -53,8 +53,13 @@ public function reworkFormForGiftCard(FormEvent $event): void return; } + $variant = $data->getCartItem()->getVariant(); + if (null === $variant) { + return; + } + /** @var ProductInterface|null $product */ - $product = $data->getCartItem()->getProduct(); + $product = $variant->getProduct(); if (null === $product) { return; }