public function save(Cart
$cart, SalesChannelContext
$context): void
{ if ($cart->
getBehavior()?->
isRecalculation()) { return;
} $shouldPersist =
$this->
shouldPersist($cart);
$event =
new CartVerifyPersistEvent($context,
$cart,
$shouldPersist);
$this->eventDispatcher->
dispatch($event);
if (!
$event->
shouldBePersisted()) { $this->
delete($cart->
getToken(),
$context);
return;
} $payloadExists =
$this->
payloadExists();
$sql = <<<'SQL'
INSERT INTO `cart` (`token`, `currency_id`, `shipping_method_id`, `payment_method_id`, `country_id`, `sales_channel_id`, `customer_id`, `price`, `line_item_count`, `cart`, `rule_ids`, `created_at`)
VALUES (:token, :currency_id, :shipping_method_id, :payment_method_id, :country_id, :sales_channel_id, :customer_id, :price, :line_item_count, :payload, :rule_ids, :now)
ON DUPLICATE KEY UPDATE `currency_id` = :currency_id, `shipping_method_id` = :shipping_method_id, `payment_method_id` = :payment_method_id, `country_id` = :country_id, `sales_channel_id` = :sales_channel_id, `customer_id` = :customer_id,`price` = :price, `line_item_count` = :line_item_count, `cart` = :payload, `rule_ids` = :rule_ids, `updated_at` = :now;