Skip to content

Commit

Permalink
fix: add cart product hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Nov 28, 2024
1 parent e30b519 commit f9e3f69
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Traits/UseHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,16 @@ public function hookActionObjectCartAddAfter($parameters)
$cart = $parameters['object'];

if (isset($cart->id)) {
$synchronizationService->sendLiveSync(Config::COLLECTION_CARTS, 'upsert');
$synchronizationService->sendLiveSync([
Config::COLLECTION_CARTS,
Config::COLLECTION_CART_PRODUCTS
],
'upsert');
$synchronizationService->insertContentIntoIncremental(
[Config::COLLECTION_CARTS => $cart->id],
[
Config::COLLECTION_CARTS => $cart->id,
Config::COLLECTION_CART_PRODUCTS => $cart->id
],
Config::INCREMENTAL_TYPE_UPSERT,
date(DATE_ATOM),
$this->shopId,
Expand All @@ -1040,9 +1047,16 @@ public function hookActionObjectCartUpdateAfter($parameters)
$cart = $parameters['object'];

if (isset($cart->id)) {
$synchronizationService->sendLiveSync(Config::COLLECTION_CARTS, 'upsert');
$synchronizationService->sendLiveSync([
Config::COLLECTION_CARTS,
Config::COLLECTION_CART_PRODUCTS
],
'upsert');
$synchronizationService->insertContentIntoIncremental(
[Config::COLLECTION_CARTS => $cart->id],
[
Config::COLLECTION_CARTS => $cart->id,
Config::COLLECTION_CART_PRODUCTS => $cart->id
],
Config::INCREMENTAL_TYPE_UPSERT,
date(DATE_ATOM),
$this->shopId,
Expand Down

0 comments on commit f9e3f69

Please sign in to comment.