wc_empty_cart()WC 1.0

Clears the cart session when called.

No Hooks.

Return

null. Nothing (null).

Usage

wc_empty_cart();

wc_empty_cart() code WC 8.9.0

function wc_empty_cart() {
	if ( ! isset( WC()->cart ) || '' === WC()->cart ) {
		WC()->cart = new WC_Cart();
	}
	WC()->cart->empty_cart( false );
}