Automattic\WooCommerce\StoreApi\Utilities

CartController::get_cart_hashes()publicWC 1.0

Get hashes for items in the current cart. Useful for tracking changes.

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

Хуков нет.

Возвращает

Массив.

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

$CartController = new CartController();
$CartController->get_cart_hashes();

Код CartController::get_cart_hashes() WC 7.1.0

public function get_cart_hashes() {
	$cart = $this->get_cart_instance();
	return [
		'line_items' => $cart->get_cart_hash(),
		'shipping'   => md5( wp_json_encode( $cart->shipping_methods ) ),
		'fees'       => md5( wp_json_encode( $cart->get_fees() ) ),
		'coupons'    => md5( wp_json_encode( $cart->get_applied_coupons() ) ),
		'taxes'      => md5( wp_json_encode( $cart->get_taxes() ) ),
	];
}