WC_Cart::__construct()publicWC 1.0

Constructor for the cart class. Loads options and hooks in the init method.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WC_Cart = new WC_Cart();
$WC_Cart->__construct();

Код WC_Cart::__construct() WC 8.7.0

public function __construct() {
	$this->session  = new WC_Cart_Session( $this );
	$this->fees_api = new WC_Cart_Fees();

	// Register hooks for the objects.
	$this->session->init();

	add_action( 'woocommerce_add_to_cart', array( $this, 'calculate_totals' ), 20, 0 );
	add_action( 'woocommerce_applied_coupon', array( $this, 'calculate_totals' ), 20, 0 );
	add_action( 'woocommerce_cart_item_removed', array( $this, 'calculate_totals' ), 20, 0 );
	add_action( 'woocommerce_cart_item_restored', array( $this, 'calculate_totals' ), 20, 0 );
	add_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_items' ), 1 );
	add_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_coupons' ), 1 );
	add_action( 'woocommerce_after_checkout_validation', array( $this, 'check_customer_coupons' ), 1, 2 );
}