Web Pixels RestrictedUrlError: Requests are not allowed to the same origin

I wanted to use Cart API to add a line item properties when product_added_to_cartevent is triggered, but I got aRestrictedUrlError: Requests are not allowed to the same origincors error. Am I missing something? This is the docs I followed to implement Cart API https://shopify.dev/docs/api/ajax/reference/cart

@chilisramen Did you find a solution for this? I am running into a similar issue…

Hi @Winterfell1 to avoid this, I had to call add a separate backend (using app proxy) to process the payload coming from the WebPixel and then this other backend takes care of updating the CartApi. Check the drawing below. I’m sure there should be a better way to get this to work but this is the way I figured it out. Take into account that you will need the storefront access token to modify the cart lines. Also instead of using AjaxApi, I used the other AdminAPIs you can use Rest or GraphQL.

Hope it helps!