I am building a headless site with nuxt3 and using netlify edge functions.
The checkout page is a subdomain, https://checkout.myshop.com
and the main domain is https://myshop.com
A shopify webhook has been setup so that once the user completes a checkout, the edge function endpoint gets hit.
The only thing I want to do is clear the cookie cartId
for the site.
In the netlify edge function file I have the following code:
export default async (req, context) => {
context.cookies.delete("cartId")
}
I think I went about doing this the wrong way because I was thinking the edge function would run as a side effect and clear the cookie for the site, but since the incoming request is from a subdomain, this does not work.
I also tried this and that still does not work
export default async () => {
context.cookies.delete({
name: "cartId",
domain: "https://myshop.com"
})
}