Disable woocommerce cookies and delete cart data automatically

Question

I have a woocommerce website for some reasons I want to disable the cookies that saves the cart data if user closes his browser and come back to website after like an hour or 4 hours the cart needs to be empty I don’t want his/ her data to be saved to woocoomerce cart. Please help me out with the solution for this as I searched alot on google but no solution is available for this.

This is the code I used

add_filter(‘wc_session_expiring’, ‘so_26545001_filter_session_expiring’ );

function so_26545001_filter_session_expiring($seconds) {
return 60 * 60 * 23; // 23 hours
}

add_filter(‘wc_session_expiration’, ‘so_26545001_filter_session_expired’ );

function so_26545001_filter_session_expired($seconds) {
return 60 * 60 * 24; // 24 hours
}
but after adding this I can still see the items in the cart which had been added days ago

Thank You

0
Usman Khan 2 years 2020-12-21T12:10:22-05:00 0 Answers 3 views 0

Leave an answer

Browse
Browse