Hello, i'm trying to run the following code on my localhost from this page https://shopify.dev/api/ajax/reference/cart(I've replaced the ID with the existing product)
And I'm getting this:
What's the issue here? As far as I know there shouldn't be such file, as this is an endpoint for API.
Yes, I had the same problem, we can't test add to cart locally, but it should work after deployment.
If window.Shopify.routes.root doesn't work for you try replacing it with window.origin.
In my case its working.
Do let me me know in case you still got some error, may be I would be able to help.