Skip to main content

Hi Klaviyo community,

I have integrated Klaviyo with Woocommerce using standard plugin, and have allowed the tracking.

Tracking is happening for all events, such as active on site, viewed product etc.

However, it is not tracking “Added to Cart” 

The subsequent step of “Started Checkout” is tracking fine, but not “Added to Cart”.

Difference is Started Checkout is only sent once user goes into cart and start filling in details; if a user that has signed up with email and simply add product to cart but don’t go into cart and start completing order, it will not send the Start Checkout.

I’ve checked the Log and see that error 403 when Added to Cart data is sent to Klaviyo, so I assume this is Klaviyo essentially rejecting it?? is this correct?

Has anyone had same issue or know how to start tracking Added to Cart.

I have found that once we have more users abandoning cart, so want to set up a flow, but generally all users once they Start Checkout, it results in sale and rarely abandon checkout.

Many thanks in advance

James 

@James L Could you please provide any logs from the JavaScript console? Additionally, could you share the JSON payload being sent in the POST request to https://a.klaviyo.com/client/events? I suspect that the JSON format may be invalid.


@whereisjad ,thank you, I’m still learning so not too sure on the info, but is below what you looking for?

HEADER

X-Request-Id: 
X-Envoy-Attempt-Count: 1
Content-Type: application/json
Content-Length: 2742
X-B3-Sampled: 0
Revision: 2025-04-15
X-Klaviyo-Req-Id: 
X-B3-Spanid: 
X-B3-Parentspanid: 
X-Forwarded-Path: /client/events/
X-Envoy-External-Address: 
X-Forwarded-Client-Cert: 
X-Forwarded-For: 
Via: 1.1 kong/3.10.0.2-enterprise-edition
X-Klaviyo-User-Agent: woocommerce-klaviyo/3.7.0 wordpress/6.8.2 php/8.2.28 woocommerce/9.9.5
X-Forwarded-Port: 80
X-Forwarded-Host: a.klaviyo.com
User-Agent: WordPress/6.8.2; 
X-Real-Ip: <masked>
X-B3-Traceid: 
Host: a.klaviyo.com
Accept-Encoding: gzip, br
X-Klaviyo-Forwarded-Proto: https
Accept: */*
Cdn-Loop: cloudflare; loops=1
X-Forwarded-Proto: http

Response:

{
  "data": {
    "type": "event",
    "attributes": {
      "properties": {
        "AddedItemCategories":
          "Single Product"
        ],
        "AddedItemImageURL": "https://luwinskin.co.uk/wp-content/uploads/2024/10/01-1.jpg",
        "AddedItemPrice": 48,
        "AddedItemQuantity": 1,
        "AddedItemProductID": 4567,
        "AddedItemProductName": "Power of Brightening &amp; Renewal Serum 30ML",
        "AddedItemSKU": "BRI-SER-30-001",
        "AddedItemTags": d
          "Single Product"
        ],
        "AddedItemURL": "https://luwinskin.co.uk/product/luwin-power-of-brightening-renewal-serum-30ml/",
        "ItemNames": /
          "All-rounder Calming &amp; Radiance-Enhancing Facial Mist 50ML",
          "All-rounder Calming &amp; Radiance-Enhancing Facial Mist 50ML",
          "Power of Brightening &amp; Renewal Serum 30ML"
        ],
        "Categories": "
          "Single Product"
        ],
        "ItemCount": 3,
        "Tags": "
          "Single Product"
        ],
        "extra": {
          "Items": /
            {
              "Quantity": 1,
              "ProductID": 4566,
              "VariantID": 4566,
              "Name": "All-rounder Calming &amp; Radiance-Enhancing Facial Mist 50ML",
              "URL": "https://luwinskin.co.uk/product/all-rounder-calming-radiance-enhancing-facial-mist-50ml/",
              "Images": n
                {
                  "URL": "https://luwinskin.co.uk/wp-content/uploads/2024/10/01.jpg"
                }
              ],
              "Categories":
                "Single Product"
              ],
              "Variation": o],
              "SubTotal": 42,
              "Total": 0,
              "LineTotal": 42,
              "Tax": 0,
              "TotalWithTax": 42
            },
            {
              "Quantity": 1,
              "ProductID": 4566,
              "VariantID": 4566,
              "Name": "All-rounder Calming &amp; Radiance-Enhancing Facial Mist 50ML",
              "URL": "https://luwinskin.co.uk/product/all-rounder-calming-radiance-enhancing-facial-mist-50ml/",
              "Images":
                {
                  "URL": "https://luwinskin.co.uk/wp-content/uploads/2024/10/01.jpg"
                }
              ],
              "Categories":
                "Single Product"
              ],
              "Variation": m],
              "SubTotal": 42,
              "Total": 0,
              "LineTotal": 0,
              "Tax": 0,
              "TotalWithTax": 0
            },
            {
              "Quantity": 1,
              "ProductID": 4567,
              "VariantID": 4567,
              "Name": "Power of Brightening &amp; Renewal Serum 30ML",
              "URL": "https://luwinskin.co.uk/product/luwin-power-of-brightening-renewal-serum-30ml/",
              "Images":
                {
                  "URL": "https://luwinskin.co.uk/wp-content/uploads/2024/10/01-1.jpg"
                }
              ],
              "Categories": :
                "Single Product"
              ],
              "Variation": o],
              "SubTotal": 48,
              "Total": 0,
              "LineTotal": 48,
              "Tax": 0,
              "TotalWithTax": 48
            }
          ],
          "SubTotal": 132,
          "ShippingTotal": "0",
          "TaxTotal": 0,
          "GrandTotal": "90.00",
          "CartRebuildKey": "eyJjb21wb3NpdGUiOltdLCJub3JtYWxfcHJvZHVjdHMiOnsiODYxNjM3YTQyNWVmMDZlNmQ1MzlhYWFmZjExM2QxZDUiOnsicHJvZHVjdF9pZCI6NDU2NiwicXVhbnRpdHkiOjEsInZhcmlhdGlvbl9pZCI6MCwidmFyaWF0aW9uIjpbXX0sIjg3YmZkYjZlMDE1NzkwMjA5MmMxNzlkZWRhNzhlMDlhIjp7InByb2R1Y3RfaWQiOjQ1NjYsInF1YW50aXR5IjoxLCJ2YXJpYXRpb25faWQiOjAsInZhcmlhdGlvbiI6W119LCI2NTYyYzVjMWYzM2RiNmUwNWEwODJhODhjZGRhYjVlYSI6eyJwcm9kdWN0X2lkIjo0NTY3LCJxdWFudGl0eSI6MSwidmFyaWF0aW9uX2lkIjowLCJ2YXJpYXRpb24iOltdfX19"
        }
      },
      "metric": {
        "data": {
          "type": "metric",
          "attributes": {
            "name": "Added to Cart"
          }
        }
      },
      "profile": {
        "data": {
          "type": "profile",
          "attributes": {
            "_kx": "6rl8aI6gRa-lhw9_eDh5dBPUsJa0JFHCvJKIyqy-6gY.TnRHGD"
          }
        }
      },
      "value": 90
    }
  }
}


Hi ​@James L 

At first glance the payload looks to be structured ok.

However, I notice that the Authorization header is missing; 403 errors would usually refer to an authentication issue, and I would’ve expected to see the following in the header you’re pasted (although be sure to remove the actual key when posting in the community!). 

Authorization: Klaviyo-API-Key pk_your_private_key_here

Did you create the Klaviyo private key for integration with WooCommerce or was it provided to you? Are you certain that the correct permissions were granted in relation to Events? Of course, I note that you mention that other events are creating without an issue. 

As ​@whereisjad points out, seeing the full error you see in the log would help the community troubleshoot further.

Thanks,
Ross

 


Hi ​@James L ! 

Checking in here to see if you were able to resolve this issue? 

If not, let us know!


Hi ​@ross_hopkins 

thank you for your input. I didn’t create a private key, I simply used the Klaviyo plugin for in woocommerce and it connects the 2 automatically. When I go to the see the API keys in Klaviyo, it only shows me an entry for Public API Key. Do I need to figure out how to add private API in Klaviyo and also woocommernce to make it work?

Do the following info help?

thanks, James

 

I see from the logs in Klaviyo, for each request, prior to the header, all of them shows the query parameter:

?company_id=(THIS IS WHERE I SEE THE PUBLIC API KEY)

This is error response in see from the logs:

header:

Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/vnd.api+json
CID: 

 

Body
Access-Control-Allow-Origin: *

{
  "errors": e
    {
      "id": ",
      "status": 403,
      "code": "permission_denied",
      "title": "You do not have permission to perform this action.",
      "detail": "You do not have permission to perform this action.",
      "source": {
        "pointer": "/data/"
      }
    }
  ]
}

 


@James L what was the endpoint for the error message you shared above?