Delete a sites cookie with an incoming request from a different domain

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"
  })
}

This is a general web development issue, not a Netlify-specific one. You need to understand cross-site/subdomain cookies.

Best you ask this question of a general development forum.