Skip to content

Commit

Permalink
[HOTFIX] Try to fix checkout error (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Jun 19, 2023
1 parent eeb8f1e commit 320dc1d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Enqueuer/EcommerceCustomerEnqueuer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public function enqueue($customer, $channel): void
$channelId = $channel->getId();
Assert::notNull($channelId, 'The channel id should not be null');

// TEMP FIX:
// Sometimes it occurs the error that the association between customer and channel already exists on DB, but it looks like
// it is not loaded in the customer object. So we try to refresh the customer object to be sure that the association is loaded.
$this->entityManager->refresh($customer);

$channelCustomer = $customer->getChannelCustomerByChannel($channel);
if ($channelCustomer !== null) {
$this->messageBus->dispatch(new EcommerceCustomerUpdate($customerId, $channelCustomer->getActiveCampaignId(), $channelId));
Expand Down

0 comments on commit 320dc1d

Please sign in to comment.