Ecommerce order always with quantity "0" (Manually Tracking Ecommerce)

We have implemented a manual ecommerce tracking in our online store. Except for a strange behavior, everything works fine.
We track the shopping cart, which works fine and is visible in Matomo. However, when we call the event
“trackEcommerceOrder” the amounts are taken over correctly. However, the quantity is always set to “0”.

From our perspective, we do everything as described on the page “https://matomo.org/faq/reports/advanced-manually-tracking-ecommerce-actions-in-matomo/”.

Here the executed JS on our conformation page:

var _paq = window._paq = window._paq || [];

// Clear Cart
_paq.push(['clearEcommerceCart']);

// Push Items
items.forEach( function (item) {
	_paq.push(['addEcommerceItem', item.sku, item.productName, item.categoryName, item.price, item.quantity]);
});

_paq.push(['trackEcommerceCartUpdate', grandTotal]);
_paq.push(['trackEcommerceOrder', orderId, grandTotal, subTotal, tax, shipping, discount ]);

What are we doing wrong? Or why is the quantity always “0”?

The same question to dears @V.K @heurteph-ei
My ecommerce order always with “0” quantity.

image

Please, help us :grinning:

@chris.op @Julia_A
Can you share the full order event in the ecommerce log?
Eg:
image

1 Like

Hi @heurteph-ei Philippe!
Thanks a lot for your time.
This is full ecommerce log.


@Julia_A
Are you sure you added some code like:

_paq.push(['addEcommerceItem',
    "0123456789", // (Required) productSKU
    "Ecommerce Analytics Book", // (Optional) productName
    ["Books", "Best sellers"], // (Optional) productCategory
    9.99, // (Recommended) price
    1 // (Optional, defaults to 1) quantity
]);

// Pass the Cart's Total Value as a numeric parameter
_paq.push(['trackEcommerceCartUpdate', 15.5]); 

Can you share the code you used?
Can you add some console.log inside this code to be sure it is run?
Can you check in the browser console there is no JavaScript error?
At least, can you check in the browser network console that the cart update request is well sent?

1 Like

Thanks @heurteph-ei Philippe!
I will try to check these all.
And show you my code a little bit later.