WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Cart::empty_cart() public WC 1.0

Empties the cart and optionally the persistent cart too.

Это метод класса: WC_Cart{}

Возвращает

Null. Ничего.

Использование

$WC_Cart = new WC_Cart();
$WC_Cart->empty_cart( $clear_persistent_cart );
$clear_persistent_cart(true/false)
Should the persistant cart be cleared too.
По умолчанию: true

Код WC_Cart::empty_cart() WC 4.5.2

woocommerce/includes/class-wc-cart.php
<?php
public function empty_cart( $clear_persistent_cart = true ) {

	do_action( 'woocommerce_before_cart_emptied', $clear_persistent_cart );

	$this->cart_contents              = array();
	$this->removed_cart_contents      = array();
	$this->shipping_methods           = array();
	$this->coupon_discount_totals     = array();
	$this->coupon_discount_tax_totals = array();
	$this->applied_coupons            = array();
	$this->totals                     = $this->default_totals;

	if ( $clear_persistent_cart ) {
		$this->session->persistent_cart_destroy();
	}

	$this->fees_api->remove_all_fees();

	do_action( 'woocommerce_cart_emptied', $clear_persistent_cart );
}