# Change cookie time for "cart"

**URL:** <https://forum.litium.com/t/change-cookie-time-for-cart/2659>\
**Category:** Questions\
**Tags:** litium-8\
**Created:** [August 31, 2022, 7:36am UTC](https://forum.litium.com/t/change-cookie-time-for-cart/2659 "2022-08-31T07:36:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [August 31, 2022, 12:32pm UTC](https://forum.litium.com/t/change-cookie-time-for-cart/2659/2 "2022-08-31T12:32:48Z")

</div>

I haven’t tested but maybe you can modify that with the OnAppendCookie method that you can configure in Startup.cs

```nohighlight
        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);
                    }
                };
            });

```

---

_[View the full topic](https://forum.litium.com/t/change-cookie-time-for-cart/2659)._
