Skip to content

Commit 4f6514c

Browse files
committed
ACP2E-1880: adapt for decimal quantity and allow several decimals on price
1 parent f24a329 commit 4f6514c

File tree

1 file changed

+2
-4
lines changed
  • app/code/Magento/GoogleAnalytics/Block

1 file changed

+2
-4
lines changed

app/code/Magento/GoogleAnalytics/Block/Ga.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ public function getOrdersTrackingCode()
122122
foreach ($collection as $order) {
123123
$result[] = "ga('set', 'currencyCode', '" . $order->getOrderCurrencyCode() . "');";
124124
foreach ($order->getAllVisibleItems() as $item) {
125-
$quantity = (float)$item->getQtyOrdered();
126-
$quantity = fmod($quantity, 1) !== 0.00 ? $quantity : (int)$quantity;
125+
$quantity = $item->getQtyOrdered() * 1;
127126
$format = fmod($quantity, 1) !== 0.00 ? '%.2f' : '%d';
128127
$result[] = sprintf(
129128
"ga('ec:addProduct', {
@@ -237,8 +236,7 @@ public function getOrdersTrackingData()
237236

238237
foreach ($collection as $order) {
239238
foreach ($order->getAllVisibleItems() as $item) {
240-
$quantity = (float)$item->getQtyOrdered();
241-
$quantity = fmod($quantity, 1) !== 0.00 ? $quantity : (int)$quantity;
239+
$quantity = $item->getQtyOrdered() * 1;
242240
$result['products'][] = [
243241
'id' => $this->escapeJsQuote($item->getSku()),
244242
'name' => $this->escapeJsQuote($item->getName()),

0 commit comments

Comments
 (0)