Cartcontext between sub domains

Hello.

I have two subdomains:
a.example.com
b.example.com

How do I make sure that the cart is saved when I switch from one subdomain to another?

Litium version: 8.11.6

You can tell litium to save the cart.
Since it is two different domains cookies will be handled in same manner as if they where two completely different domains.

/Litium/ECommerce/SettingsShoppingCart.aspx

I remember that setting - but I can’t seem to find it in L8.

How and when is the cart-context cookie set?

I will try setting the domain using OnAppendCookie for the CookiePolicyOptions

HI you can try this in services.Configure<CookiePolicyOptions>() on the Startup.cs:

options.OnAppendCookie = x =>
{
    if (x.Context.Request.Host.Host.EndsWith(".example.com"))
    {
        x.CookieOptions.Domain = ".example.com";
    }
};
options.OnDeleteCookie = x =>
{
    if (x.Context.Request.Host.Host.EndsWith(".example.com"))
    {
        x.CookieOptions.Domain = ".example.com";
    }
};
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.