I haven’t tested but maybe you can modify that with the OnAppendCookie method that you can configure in Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
options.Secure = CookieSecurePolicy.SameAsRequest;
// Change the time on the cookes that are set
options.OnAppendCookie = ctx =>
{
if (ctx.CookieName.Equals("cart"))
{
ctx.CookieOptions.Expires = DateTimeOffset.UtcNow.AddHours(6);
}
};
});