Open
Description
Environment details
PHP version: 8.1
Magento version: 2.4.5-p7
Klaviyo extension version: 4.1.3
Magento site has multiple websites, each site has separate Klaviyo settings. The A site has a different configuration with the default settings.
Steps to reproduce
- Could not unsubscribe from Marketing -> Communications -> Newsletter Subscribers
- Login to the backend, go to Marketing -> Communications -> Newsletter Subscribers
- Unsubscribe a customer from A site in the grid
- Check result
- Could not unsubscribe from the customer edit page in the Admin
- Login to the backend, go to Customers -> All Customers -> Edit a customer
- Unsubscribe a customer from A site in the Newsletter tab
- Check result
Expected result
The customer should be unsubscribed from the Klaviyo
Actual result
The customer is still subscribed to the Klaviyo
Additional information
- Please check this file klaviyo/magento2-extension/Helper/Data.php - the unsubscribeEmailFromKlaviyoList function
- The $listId value was given incorrectly
- Check file klaviyo/magento2-extension/Helper/ScopeSetting.php - the getScopeSetting function
- The $storeId is checked incorrectly. It must be obtained based on the customer's store instead of these codes
$scopedStoreCode = $this->_request->getParam('store');
$scopedWebsiteCode = $this->_request->getParam('website'); - So, I think we need to change the unsubscribeEmailFromKlaviyoList and pass in $storeId param
- We can use $storeId = $customer->getStoreId() or $subscriber->getStoreId() based on a customer is guest or not