klaviyo / magento2-klaviyo

37 stars 51 forks source link

Product Delete not Working after install Module #105

Closed alep93 closed 3 years ago

alep93 commented 3 years ago

If i comment this: Klaviyo\Reclaim\Observer\ProductDeleteBefore Product delete working fine.

The issue is on: public function execute(Observer $observer) { $product = $observer->getEvent()->getProduct(); $websiteIds = $product->getWebsiteIds(); $storeIdKlaviyoMap = $this->_klaviyoScopeSetting->getStoreIdKlaviyoAccountSetMap($websiteIds);

    foreach ($storeIdKlaviyoMap as $klaviyoId => $storeIds) {
        if (empty($storeIds)) {
            continue;
        }

        if ($this->_klaviyoScopeSetting->getWebhookSecret() && $this->_klaviyoScopeSetting->getProductDeleteBeforeSetting($storeIds[0])) {
            $data = array (
                'store_ids' => $storeIds,
                'product_id' => $product->getId(),
            );
            $this->_webhookHelper->makeWebhookRequest('product/delete', $data, $klaviyoId);
        }
    }
}

to => $storeIdKlaviyoMap = $this->_klaviyoScopeSetting->getStoreIdKlaviyoAccountSetMap($websiteIds);

remstone7 commented 3 years ago

Thanks for bringing this up, we're currently working on a fix for this!