On this page
What this issue is
In GA4, each ecommerce event (such as add_to_cart or purchase) includes an items array. Each item is one product, with fields like item_id, item_name, price and quantity. Quantity is how many units of that product are in the event.
The problem is when quantity is absent, set to 0, empty, or sent as text that GA4 cannot read. It often happens when a custom dataLayer push, a theme update or a tag template maps the wrong field, such as a stock level instead of the cart line quantity.
Why it costs you leads or sales
Bad quantity data does not stop a sale, but it makes your numbers unreliable. Item-level revenue, 'Items purchased' and product performance reports can be wrong. You may then promote the wrong products, misjudge bundles and multi-unit orders, or feed weak data into ad platforms that use the same dataLayer.
- Product pageview_item sent
- Add to cartitems[0].quantity missing
- Checkoutquantity still missing or 0
- PurchaseItem reports wrong
The sale completes, but the product data sent to GA4 is wrong from the cart onwards.
Example: 120 units sold in a week, but GA4 shows fewer because some items were sent with quantity 0 or none.
How to check if your site has it
Open GA4 DebugView
In GA4 go to Admin, then DebugView. Turn on debug mode with Google Tag Assistant or the GA debug extension, then add a product to the cart.
Click each ecommerce event
Open add_to_cart, begin_checkout and purchase. Expand the items parameter and look for quantity on each item.
Check the dataLayer
In your browser console type dataLayer and look at the ecommerce pushes. Confirm each item has quantity as a number, not a string, and not 0.
Test a multi-unit order
Add 3 units of one product. The event should show quantity 3. If it shows 1, 0 or nothing, the mapping is wrong.
Compare with reports
In Reports, Monetization, Ecommerce purchases, compare items purchased with your store's order data for the same days.
dataLayer.filter(function (e) { return e.ecommerce && e.ecommerce.items; }).forEach(function (e) {
e.ecommerce.items.forEach(function (item, i) {
if (typeof item.quantity !== 'number' || item.quantity < 1) {
console.warn(e.event, 'item', i, 'bad quantity:', item.quantity);
}
});
});How to fix it
The fix is to read the real cart line quantity and send it as a number. The exact place depends on your platform.
Check your tracking plugin
If you use a WooCommerce GA4 plugin, update it and look in its settings for ecommerce or item options. Test again in DebugView after updating.
Check custom code
If your theme or a snippet builds the items array, make sure quantity uses the cart item quantity, for example $cart_item['quantity'], and is cast to an integer.
Check the source of the events
If you use the native Google channel or an app, review its settings and update it. If a custom pixel or theme code builds items, use the line item quantity.
Use line item quantity in Liquid
In theme code, use item.quantity for cart lines and line_item.quantity on order pages, not inventory values.
Check the GA4 event tag
If the tag reads the items array from the dataLayer, make sure each pushed item has quantity. If you build items with a Custom JavaScript variable, add quantity there.
Fix variable types
Use parseInt(value, 10) in a Custom JavaScript variable so text such as '2' becomes the number 2. Default to 1 only if you are sure each line is a single unit.
Check the ecommerce tracking setup
If you added GA4 through custom code or GTM, check the code reads the cart item count. Test with Webflow's checkout in a preview or staging flow.
Review the Google Analytics connection
Check Marketing integrations for the GA4 connection and any custom code. If custom events are used, ensure they include quantity from the cart.
Check code injection
If you added custom GA4 ecommerce code under Code Injection, make sure items include quantity from the cart data.
Build items from cart lines
Map each cart line to an item with a numeric quantity of at least 1, as in the snippet below.
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: 'add_to_cart',
ecommerce: {
currency: 'USD',
value: 59.98,
items: [{
item_id: 'SKU-123',
item_name: 'Canvas Tote',
price: 29.99,
quantity: 2
}]
}
});Broken
- quantity not present on the item
- quantity: 0 from a wrong field
- quantity: "2" sent as text
Fixed
- quantity: 2 as a number
- Value comes from the cart line
- Same quantity in add_to_cart, begin_checkout and purchase
Quantity missing
Leads or data lost
Item reports can show wrong or zero units, and item revenue may not match the order.
Toggle to see the effect on item reporting.
How to confirm it's fixed
- DebugView shows quantity on every item in add_to_cart, begin_checkout and purchase
- A 3-unit test order shows quantity 3
- quantity is a number, not text
- No item has quantity 0
- Items purchased in GA4 reports matches order data after a day or two
How to prevent it happening again
Re-test ecommerce events after theme changes, plugin updates and GTM publishes. Keep one owner for the dataLayer spec and write down that each item needs item_id, item_name, price and a numeric quantity. Use GTM Preview mode before you publish any change to ecommerce tags.
How FunnelGuard handles this
FunnelGuard detects this issue only partly. It runs your real customer journey on a schedule with a robot visitor and checks the tracking hits sent to GA4. For this issue, it uses params rules on items: you can set rules on the item parameters of the GA4 hit, so a missing or wrong quantity can be flagged when the hit is checked.
What it does not cover: it does not audit every product, variant or cart combination, and it does not compare GA4 reports with your order data. It also stops before payment unless your store's test mode is set up, so a real purchase event may not be checked.
To cover the rest by hand, test a multi-unit order in DebugView after each release, run the console check above, and compare items purchased with your store's orders now and then. When a check fails, it is re-checked from a second region before one alert goes out with a screenshot and a likely cause. A free plan covers 1 site and 2 journeys with daily checks, and paid plans have a 3-day free trial.
Questions people ask
Why is my GA4 items purchased showing 0?
The items in your purchase events probably have quantity missing, 0 or text instead of a number. Check the items array in GA4 DebugView and the dataLayer, then map quantity to the real cart line quantity.
Is quantity required in the GA4 items array?
Quantity is an item parameter, and you should always send it as a number of 1 or more. Do not rely on defaults, because they can vary by event and tool, and missing values can make reports unreliable.
How do I check quantity in GA4 events?
Open Admin, then DebugView, add a product to the cart and click the add_to_cart, begin_checkout and purchase events. Expand the items parameter and confirm each item has a numeric quantity. You can also inspect dataLayer in the browser console.
Can I send quantity as a string in GA4?
Send it as a number, such as 2, not '2'. In GTM you can convert text with parseInt(value, 10) in a Custom JavaScript variable.
Does missing quantity affect my revenue in GA4?
It can affect item-level revenue and items purchased. The event-level value you send may still be correct, so compare both against your store's order data.
Why is quantity 0 in my GTM ecommerce tag?
The variable usually reads the wrong field, such as stock level, or the dataLayer push happens before the cart data is ready. Preview the tag in GTM and check which value it reads.
Can FunnelGuard detect a missing GA4 quantity?
Partly. It checks GA4 hits during a real journey using params rules on items, but it does not audit every product or compare reports with orders, so you should also test multi-unit orders by hand.
Related issues
- TRK-083items array missing from ecommerce eventsFix guide
- TRK-084items missing item_id or item_nameFix guide
- TRK-085item price sent as string or with currency symbolFix guide
- TRK-088add_to_cart missing or fires on page loadFix guide
- TRK-091ecommerce object not cleared in dataLayer (items leak into next event)Fix guide
- TRK-095Currency on items differs from event currencyFix guide