CheckoutOrderPlacedCriteriaEvent example

->addAssociation('transactions.paymentMethod')
            ->addAssociation('lineItems.cover')
            ->addAssociation('lineItems.downloads.media')
            ->addAssociation('currency')
            ->addAssociation('addresses.country')
            ->addAssociation('addresses.countryState')
            ->addAssociation('stateMachineState')
            ->addAssociation('deliveries.stateMachineState')
            ->addAssociation('transactions.stateMachineState')
            ->getAssociation('transactions')->addSorting(new FieldSorting('createdAt'));

        $this->eventDispatcher->dispatch(new CheckoutOrderPlacedCriteriaEvent($criteria$context));

        /** @var OrderEntity|null $orderEntity */
        $orderEntity = Profiler::trace('checkout-order::order-loading', fn () => $this->orderRepository->search($criteria$context->getContext())->first());

        if (!$orderEntity) {
            if (Feature::isActive('v6.6.0.0')) {
                throw CartException::invalidPaymentOrderNotStored($orderId);
            }

            throw new InvalidOrderException($orderId);
        }

        
Home | Imprint | This part of the site doesn't use cookies.