I wanted to have different data in checkout and cart. means, when someone clicked a product directly to checkout, moves just the product to checkout without items that are in the cart.
or preventing the cart from going empty after checkout payment done or is there a way to have multiple carts with all functionality on a site?
Yes there is a solution using woocommerce sessions
function temp_cart_session()
{
WC()->session = new WC_Session_Handler();
WC()->session->init();
$session = WC()->session;
if ($session->get('temp_cart')) {
if ($session->get('temp_cart') instanceof WC_Cart) {
$temp_cart = $session->get('temp_cart');
} else {
$temp_cart = new WC_Cart();
$session->set('temp_cart', $temp_cart);
}
} else {
$temp_cart = new WC_Cart();
$session->set('temp_cart', $temp_cart);
}
return $temp_cart;
}
then we can use it with main cart functions