Skip to content

Commit

Permalink
Revert "Adds StoreID field to Added to Cart and Viewed Product events (
Browse files Browse the repository at this point in the history
…#303)" (#311)

This reverts commit 5344d12.
  • Loading branch information
cykolln authored Sep 24, 2024
1 parent 5344d12 commit 81db8a1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
6 changes: 2 additions & 4 deletions Block/Catalog/Product/ViewedProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ public function getViewedProductJson()
'URL' => $_product->getProductUrl(),
'Price' => $this->getPrice(),
'FinalPrice' => $this->getFinalPrice(),
'Categories' => $this->getProductCategories(),
'StoreID' => $this->_klaviyoScopeSetting->storeId
'Categories' => $this->getProductCategories()
];

if ($this->getProductImage()) {
Expand All @@ -225,8 +224,7 @@ public function getViewedItemJson()
'Categories' => $this->getProductCategories(),
'Metadata' => array(
'Price' => $this->getPrice()
),
'StoreID' => $this->_klaviyoScopeSetting->storeId
)
];

if ($this->getProductImage()) {
Expand Down
6 changes: 0 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- BEGIN RELEASE NOTES -->
### [Unreleased]

#### Added
- Adds StoreID field to Viewed Product events

#### Changed
- Updates StoreId field to StoreID for Added to Cart events

### [4.1.4] - 2024-05-22

#### Changed
Expand Down
4 changes: 2 additions & 2 deletions Cron/KlSyncs.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ private function sendUpdatesToApp(array $groupedRows, bool $isRetry = false)

//TODO: if conditional for backward compatibility, needs to be removed in future versions
$storeId = '';
if (isset($decodedPayload['StoreID'])) {
$storeId = $decodedPayload['StoreID'];
if (isset($decodedPayload['StoreId'])) {
$storeId = $decodedPayload['StoreId'];
}

$response = $this->_dataHelper->klaviyoTrackEvent(
Expand Down
8 changes: 4 additions & 4 deletions Helper/ScopeSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ScopeSetting extends \Magento\Framework\App\Helper\AbstractHelper
/**
* @var int
*/
public $storeId;
protected $_storeId;

/**
* @var \Magento\Framework\Module\ModuleListInterface
Expand All @@ -75,7 +75,7 @@ public function __construct(
$this->_scopeConfig = $context->getScopeConfig();
$this->_request = $context->getRequest();
$this->_state = $state;
$this->storeId = $storeManager->getStore()->getId();
$this->_storeId = $storeManager->getStore()->getId();
$this->_moduleList = $moduleList;
$this->_configWriter = $configWriter;
}
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function getScopeSetting($path, $storeId = null)
$scopedWebsiteCode = $this->_request->getParam('website');
} else {
// In frontend area. Only concerned with store for frontend.
$scopedStoreCode = $this->storeId;
$scopedStoreCode = $this->_storeId;
}

if (isset($scopedStoreCode)) {
Expand Down Expand Up @@ -142,7 +142,7 @@ protected function setScopeSetting($path, $value)
$scopedWebsiteCode = $this->_request->getParam('website');
} else {
// In frontend area. Only concerned with store for frontend.
$scopedStoreCode = $this->storeId;
$scopedStoreCode = $this->_storeId;
}

if (isset($scopedStoreCode)) {
Expand Down
2 changes: 1 addition & 1 deletion Observer/SalesQuoteSaveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function execute(Observer $observer)
// Setting QuoteId at this point since the MaskedQuoteId is not updated when this event is dispatched,
$klAddedToCartPayload['QuoteId'] = isset($encodedCustomerId) ? "kx_identifier_$encodedCustomerId" : $quote->getId();
// Setting StoreId in payload
$klAddedToCartPayload['StoreID'] = $quote->getStoreId();
$klAddedToCartPayload['StoreId'] = $quote->getStoreId();

$stringifiedPayload = json_encode($klAddedToCartPayload);

Expand Down

0 comments on commit 81db8a1

Please sign in to comment.