Blog Placholder Image WooCommerce Session & Cookies Usage

WooCommerce Session & Cookies Usage

Today’s topic of discussion is, How to use sessions and cookies in WooCommerce. This programming based tutorial will guide you how to set the session, get session, and unset session.

You can access session class object by simply calling:

Set Your session:

wc()->session->set({your session},{Your value });

Get your session:

wc()->session->get({your session});

unset your session:

wc()->session->set({your session},{});

Store Session data:

Yes, WooCommerce stores the cart in database table {your dB prefix}

_woocommerce_sessions.

It retains the data for 2 hours only. After every 2 hours, your cookie and cart will expire if you are not a logged in user.

Search

Recent Blogs

Categories

Archives

Archives

Tags