trackEcommerceCartUpdate Doesnt Clear Cart Items #11766
Labels
c: Platform
For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Milestone
The docs say to use the addEcommerceItem for every item in the cart prior to calling the trackEcommerceCartUpdate method. However only the trackEcommerceOrder method clears the internal eCommerceItems variable. This causes problems when an item is completely removed from the cart - even when using addEcommerceItem with qty 0, the item still gets sent to the server and the server tracks the deleted item as still being in the cart with qty 1.
A much cleaner mechanism would seem to be to just clear the internal eCommerceItems object after every CartUpdate in addition to track order. This of course necessitates using addEcommerceItem for every item in the cart on every change to it, but the docs already say to do that. Unless I'm missing a specific reason why CartUpdate doesnt clear eCommerceItems on purpose? I'm happy to submit a pull request for this one line change but wanted to see if there was a specific reason it was written this way.
The text was updated successfully, but these errors were encountered: