Skip to content
FunnelGuard

Fix guide by FunnelsGuard

GA4 item quantity missing or 0: how to find and fix it

TRK-086Medium impactPartlyBy FunnelGuardPublished Updated
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.

Where bad quantity data enters the funnel
  1. Product pageview_item sent
  2. Add to cartitems[0].quantity missing
  3. Checkoutquantity still missing or 0
  4. PurchaseItem reports wrong

The sale completes, but the product data sent to GA4 is wrong from the cart onwards.

Items purchased reported vs realExample numbers
Items purchased reported vs real (example)Real units sold: 120 items; Items purchased in GA4: 74 items0469212074Real units soldItems purchased in GA4items

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

Inspect the items array
  1. 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.

  2. Click each ecommerce event

    Open add_to_cart, begin_checkout and purchase. Expand the items parameter and look for quantity on each item.

  3. 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.

  4. 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.

  5. Compare with reports

    In Reports, Monetization, Ecommerce purchases, compare items purchased with your store's order data for the same days.

Console check for items without a valid quantityjavascript
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.

Fix by platform
  1. 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.

  2. 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.

Correct add_to_cart pushjavascript
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
    }]
  }
});
Items array before and after

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
Try it: quantity in the items arrayInteractive
Quantity missing or 0

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

Confirmation checklist
  • 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.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: params rules on items.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.