From fb7e76dc783cc377a05ddbacb07d8e5871240a84 Mon Sep 17 00:00:00 2001 From: PromInc Date: Mon, 7 Jul 2025 12:55:00 -0500 Subject: [PATCH] Prevent 422 Insights Event - Add to Cart with Discount Adding a product to the cart may trigger a PHP and Algolia error due to the discount amount being too large. ## PHP Error ``` main.CRITICAL: Unable to send add to cart event due to Algolia events model misconfiguration: Discount must be a valid decimal number and total length must be no longer than 16 characters [] [] ``` --- Service/Insights/EventProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Service/Insights/EventProcessor.php b/Service/Insights/EventProcessor.php index 88adb9068..055c683b9 100644 --- a/Service/Insights/EventProcessor.php +++ b/Service/Insights/EventProcessor.php @@ -259,7 +259,7 @@ protected function getQuoteItemSalePrice(Item $item): float */ protected function getQuoteItemDiscount(Item $item): float { - return floatval($item->getProduct()->getPrice()) - $this->getQuoteItemSalePrice($item); + return round(floatval($item->getProduct()->getPrice()) - $this->getQuoteItemSalePrice($item),2); } /**